diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_expm1l.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_expm1l.c | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_expm1l.c b/sysdeps/ieee754/ldbl-128/s_expm1l.c index b1100a9d0e..66881af01a 100644 --- a/sysdeps/ieee754/ldbl-128/s_expm1l.c +++ b/sysdeps/ieee754/ldbl-128/s_expm1l.c @@ -57,41 +57,43 @@ #include <float.h> #include <math.h> #include <math_private.h> +#include <math-underflow.h> +#include <libm-alias-ldouble.h> /* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x) -.5 ln 2 < x < .5 ln 2 Theoretical peak relative error = 8.1e-36 */ -static const long double - P0 = 2.943520915569954073888921213330863757240E8L, - P1 = -5.722847283900608941516165725053359168840E7L, - P2 = 8.944630806357575461578107295909719817253E6L, - P3 = -7.212432713558031519943281748462837065308E5L, - P4 = 4.578962475841642634225390068461943438441E4L, - P5 = -1.716772506388927649032068540558788106762E3L, - P6 = 4.401308817383362136048032038528753151144E1L, - P7 = -4.888737542888633647784737721812546636240E-1L, - Q0 = 1.766112549341972444333352727998584753865E9L, - Q1 = -7.848989743695296475743081255027098295771E8L, - Q2 = 1.615869009634292424463780387327037251069E8L, - Q3 = -2.019684072836541751428967854947019415698E7L, - Q4 = 1.682912729190313538934190635536631941751E6L, - Q5 = -9.615511549171441430850103489315371768998E4L, - Q6 = 3.697714952261803935521187272204485251835E3L, - Q7 = -8.802340681794263968892934703309274564037E1L, +static const _Float128 + P0 = L(2.943520915569954073888921213330863757240E8), + P1 = L(-5.722847283900608941516165725053359168840E7), + P2 = L(8.944630806357575461578107295909719817253E6), + P3 = L(-7.212432713558031519943281748462837065308E5), + P4 = L(4.578962475841642634225390068461943438441E4), + P5 = L(-1.716772506388927649032068540558788106762E3), + P6 = L(4.401308817383362136048032038528753151144E1), + P7 = L(-4.888737542888633647784737721812546636240E-1), + Q0 = L(1.766112549341972444333352727998584753865E9), + Q1 = L(-7.848989743695296475743081255027098295771E8), + Q2 = L(1.615869009634292424463780387327037251069E8), + Q3 = L(-2.019684072836541751428967854947019415698E7), + Q4 = L(1.682912729190313538934190635536631941751E6), + Q5 = L(-9.615511549171441430850103489315371768998E4), + Q6 = L(3.697714952261803935521187272204485251835E3), + Q7 = L(-8.802340681794263968892934703309274564037E1), /* Q8 = 1.000000000000000000000000000000000000000E0 */ /* C1 + C2 = ln 2 */ - C1 = 6.93145751953125E-1L, - C2 = 1.428606820309417232121458176568075500134E-6L, + C1 = L(6.93145751953125E-1), + C2 = L(1.428606820309417232121458176568075500134E-6), /* ln 2^-114 */ - minarg = -7.9018778583833765273564461846232128760607E1L, big = 1e4932L; + minarg = L(-7.9018778583833765273564461846232128760607E1), big = L(1e4932); -long double -__expm1l (long double x) +_Float128 +__expm1l (_Float128 x) { - long double px, qx, xx; + _Float128 px, qx, xx; int32_t ix, sign; ieee854_long_double_shape_type u; int k; @@ -110,9 +112,9 @@ __expm1l (long double x) { /* Infinity (which must be negative infinity). */ if (((ix & 0xffff) | u.parts32.w1 | u.parts32.w2 | u.parts32.w3) == 0) - return -1.0L; - /* NaN. No invalid exception. */ - return x; + return -1; + /* NaN. Invalid exception if signaling. */ + return x + x; } /* expm1(+- 0) = +- 0. */ @@ -121,12 +123,12 @@ __expm1l (long double x) /* Minimum value. */ if (x < minarg) - return (4.0/big - 1.0L); + return (4.0/big - 1); /* Avoid internal underflow when result does not underflow, while ensuring underflow (without returning a zero of the wrong sign) when the result does underflow. */ - if (fabsl (x) < 0x1p-113L) + if (fabsl (x) < L(0x1p-113)) { math_check_force_underflow (x); return x; @@ -158,9 +160,9 @@ __expm1l (long double x) exp(x) - 1 = 2^k (qx + 1) - 1 = 2^k qx + 2^k - 1. */ - px = __ldexpl (1.0L, k); + px = __ldexpl (1, k); x = px * qx + (px - 1.0); return x; } libm_hidden_def (__expm1l) -weak_alias (__expm1l, expm1l) +libm_alias_ldouble (__expm1, expm1) |