Mercurial > mxe-octave
comparison src/build-msvctools/math/expm1.c @ 3061:f8299bb6c872
Initial support for native MSVC compilation.
* add MSVC support files: compiler wrappers and support libraries
* adapt libiconv to work with MSVC
* adapt gettext to work with MSVC
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 17 Jun 2013 22:43:11 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3060:cbdf4575016d | 3061:f8299bb6c872 |
---|---|
1 /* | |
2 * Written 2005 by Gregory W. Chicares <chicares@cox.net>. | |
3 * Adapted to double by Danny Smith <dannysmith@users.sourceforge.net>. | |
4 * Public domain. | |
5 * | |
6 * F2XM1's input is constrained to (-1, +1), so the domain of | |
7 * 'x * LOG2EL' is (-LOGE2L, +LOGE2L). Outside that domain, | |
8 * delegating to exp() handles C99 7.12.6.3/2 range errors. | |
9 * | |
10 * Constants from moshier.net, file cephes/ldouble/constl.c, | |
11 * are used instead of M_LN2 and M_LOG2E, which would not be | |
12 * visible with 'gcc std=c99'. The use of these extended precision | |
13 * constants also allows gcc to replace them with x87 opcodes. | |
14 */ | |
15 | |
16 #include <math.h> /* expl() */ | |
17 #include "cephes_mconf.h" | |
18 double expm1 (double x) | |
19 { | |
20 if (fabs(x) < LOGE2L) | |
21 { | |
22 x *= LOG2EL; | |
23 __asm__("f2xm1" : "=t" (x) : "0" (x)); | |
24 return x; | |
25 } | |
26 else | |
27 return exp(x) - 1.0; | |
28 } |