Ads by ProfitSence
Close

C++ expm1()

Last Updated on Wednesday 5th Oct 2022

The C++ expm1() function returns the exponential (Euler's number) e raised to the given argument minus 1. It is defined in the <cmath> header file.

Syntax

			
					expm1(x);

			
	

Parameters

The expm1() function takes a one argument which can be any value i.e. negative, positive or zero.

Return value

Returns the value in the range of [-1, ∞].

If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL with the proper sign, and an overflow range error occurs.

expm1() prototype [As of C++ 11 standard]

			
					double expm1(double x);
float expm1(float x);
long double expm1(long double x); 
double expm1(T x); // Here T is an integral type.

			
	

Example : C++ expm1()

			
					#include <stdio.h>
#include <math.h>

int main () {
  double param, result;
  param = 4.0;
  result = expm1(param);
  printf ("expm1 (%f) = %f.\n", param, result );
  return 0;
}

			
	

Output

			
					expm1 (4.000000) = 53.598150.