1 /* Definitions of some C99 math library functions, for those platforms
2 that don't implement these functions already. */
7 /* Mathematically, expm1(x) = exp(x) - 1. The expm1 function is designed
8 to avoid the significant loss of precision that arises from direct
9 evaluation of the expression exp(x) - 1, for x near 0. */
14 /* For abs(x) >= log(2), it's safe to evaluate exp(x) - 1 directly; this
15 also works fine for infinities and nans.
17 For smaller x, we can use a method due to Kahan that achieves close to
27 return (u
- 1.0) * x
/ log(u
);