From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/c/numeric%2Fmath%2Fexpm1.html | 83 ----------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 devdocs/c/numeric%2Fmath%2Fexpm1.html (limited to 'devdocs/c/numeric%2Fmath%2Fexpm1.html') diff --git a/devdocs/c/numeric%2Fmath%2Fexpm1.html b/devdocs/c/numeric%2Fmath%2Fexpm1.html deleted file mode 100644 index 75918aa8..00000000 --- a/devdocs/c/numeric%2Fmath%2Fexpm1.html +++ /dev/null @@ -1,83 +0,0 @@ -

expm1, expm1f, expm1l

Defined in header <math.h>
float       expm1f( float arg );
-
(1) (since C99)
double      expm1( double arg );
-
(2) (since C99)
long double expm1l( long double arg );
-
(3) (since C99)
Defined in header <tgmath.h>
#define expm1( arg )
-
(4) (since C99)
-1-3) Computes the e (Euler's number, 2.7182818) raised to the given power arg, minus 1.0. This function is more accurate than the expression exp(arg)-1.0 if arg is close to zero.
-4) Type-generic macro: If arg has type long double, expm1l is called. Otherwise, if arg has integer type or the type double, expm1 is called. Otherwise, expm1f is called.

Parameters

- -
arg - floating point value

Return value

If no errors occur earg-1 is returned.

-

If a range error due to overflow occurs, +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL is returned.

-

If a range error occurs due to underflow, the correct result (after rounding) is returned.

-

Error handling

Errors are reported as specified in math_errhandling.

-

If the implementation supports IEEE floating-point arithmetic (IEC 60559),

-

Notes

The functions expm1 and log1p are useful for financial calculations, for example, when calculating small daily interest rates: (1+x)n-1 can be expressed as expm1(n * log1p(x)). These functions also simplify writing accurate inverse hyperbolic functions.

-

For IEEE-compatible type double, overflow is guaranteed if 709.8 < arg.

-

Example

#include <stdio.h>
-#include <math.h>
-#include <float.h>
-#include <errno.h>
-#include <fenv.h>
-// #pragma STDC FENV_ACCESS ON
-int main(void)
-{
-    printf("expm1(1) = %f\n", expm1(1));
-    printf("Interest earned in 2 days on $100, compounded daily at 1%%\n"
-           " on a 30/360 calendar = %f\n",
-           100*expm1(2*log1p(0.01/360)));
-    printf("exp(1e-16)-1 = %g, but expm1(1e-16) = %g\n",
-           exp(1e-16)-1, expm1(1e-16));
-    // special values
-    printf("expm1(-0) = %f\n", expm1(-0.0));
-    printf("expm1(-Inf) = %f\n", expm1(-INFINITY));
-    //error handling
-    errno = 0; feclearexcept(FE_ALL_EXCEPT);
-    printf("expm1(710) = %f\n", expm1(710));
-    if(errno == ERANGE) perror("    errno == ERANGE");
-    if(fetestexcept(FE_OVERFLOW)) puts("    FE_OVERFLOW raised");
-}

Possible output:

-
expm1(1) = 1.718282
-Interest earned in 2 days on $100, compounded daily at 1%
- on a 30/360 calendar = 0.005556
-exp(1e-16)-1 = 0, but expm1(1e-16) = 1e-16
-expm1(-0) = -0.000000
-expm1(-Inf) = -1.000000
-expm1(710) = inf
-    errno == ERANGE: Result too large
-    FE_OVERFLOW raised

References

See also

- - - -
-
(C99)(C99)
computes e raised to the given power (\({\small e^x}\)ex)
(function)
-
(C99)(C99)(C99)
computes 2 raised to the given power (\({\small 2^x}\)2x)
(function)
-
(C99)(C99)(C99)
computes natural (base-e) logarithm of 1 plus the given number (\({\small \ln{(1+x)} }\)ln(1+x))
(function)
C++ documentation for expm1
-

- © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
- https://en.cppreference.com/w/c/numeric/math/expm1 -

-
-- cgit v1.2.3