A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/cmath/expm1/ below:

function

<cmath> <ctgmath>

expm1
     double expm1  (double x);      float expm1f (float x);long double expm1l (long double x);
     double expm1 (double x);      float expm1 (float x);long double expm1 (long double x);     double expm1 (T x);           // additional overloads for integral types

Compute exponential minus one

Returns e raised to the power x minus one: ex-1.

For small magnitude values of x, expm1 may be more accurate than exp(x)-1.

Header

<tgmath.h>

provides a type-generic macro version of this function.


Additional overloads

are provided in this header (

<cmath>

) for the

integral types

: These overloads effectively cast

x

to a

double

before calculations (defined for

T

being any

integral type

).



Parameters
x
Value of the exponent.

Return Valuee raised to the power of x, minus one.
If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign, and an overflow range error occurs:

If an overflow range error occurs:


- And math_errhandling has MATH_ERRNO set: the global variable errno is set to ERANGE.
- And math_errhandling has MATH_ERREXCEPT set: FE_OVERFLOW is raised.

Example
1
2
3
4
5
6
7
8
9
10
11
12
/* expm1 example */
#include <stdio.h>      /* printf */
#include <math.h>       /* expm1 */

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

Output:
expm1 (1.000000) = 1.718282.


See also
exp
Compute exponential function (function)
log1p
Compute logarithm plus one (function)
pow
Raise to power (function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4