summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128/e_expl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/e_expl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/e_expl.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/sysdeps/ieee754/ldbl-128/e_expl.c b/sysdeps/ieee754/ldbl-128/e_expl.c
index 7b71e644be..b4b21c4957 100644
--- a/sysdeps/ieee754/ldbl-128/e_expl.c
+++ b/sysdeps/ieee754/ldbl-128/e_expl.c
@@ -1,5 +1,5 @@
/* Quad-precision floating point e^x.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jj@ultra.linux.cz>
Partly based on double-precision code
@@ -64,58 +64,60 @@
#include <math.h>
#include <fenv.h>
#include <inttypes.h>
+#include <math-barriers.h>
#include <math_private.h>
+#include <math-underflow.h>
#include <stdlib.h>
#include "t_expl.h"
-static const long double C[] = {
+static const _Float128 C[] = {
/* Smallest integer x for which e^x overflows. */
#define himark C[0]
- 11356.523406294143949491931077970765L,
+ L(11356.523406294143949491931077970765),
/* Largest integer x for which e^x underflows. */
#define lomark C[1]
--11433.4627433362978788372438434526231L,
+L(-11433.4627433362978788372438434526231),
/* 3x2^96 */
#define THREEp96 C[2]
- 59421121885698253195157962752.0L,
+ L(59421121885698253195157962752.0),
/* 3x2^103 */
#define THREEp103 C[3]
- 30423614405477505635920876929024.0L,
+ L(30423614405477505635920876929024.0),
/* 3x2^111 */
#define THREEp111 C[4]
- 7788445287802241442795744493830144.0L,
+ L(7788445287802241442795744493830144.0),
/* 1/ln(2) */
#define M_1_LN2 C[5]
- 1.44269504088896340735992468100189204L,
+ L(1.44269504088896340735992468100189204),
/* first 93 bits of ln(2) */
#define M_LN2_0 C[6]
- 0.693147180559945309417232121457981864L,
+ L(0.693147180559945309417232121457981864),
/* ln2_0 - ln(2) */
#define M_LN2_1 C[7]
--1.94704509238074995158795957333327386E-31L,
+L(-1.94704509238074995158795957333327386E-31),
/* very small number */
#define TINY C[8]
- 1.0e-4900L,
+ L(1.0e-4900),
/* 2^16383 */
#define TWO16383 C[9]
- 5.94865747678615882542879663314003565E+4931L,
+ L(5.94865747678615882542879663314003565E+4931),
/* 256 */
#define TWO8 C[10]
- 256.0L,
+ 256,
/* 32768 */
#define TWO15 C[11]
- 32768.0L,
+ 32768,
/* Chebyshev polynom coefficients for (exp(x)-1)/x */
#define P1 C[12]
@@ -124,22 +126,22 @@ static const long double C[] = {
#define P4 C[15]
#define P5 C[16]
#define P6 C[17]
- 0.5L,
- 1.66666666666666666666666666666666683E-01L,
- 4.16666666666666666666654902320001674E-02L,
- 8.33333333333333333333314659767198461E-03L,
- 1.38888888889899438565058018857254025E-03L,
- 1.98412698413981650382436541785404286E-04L,
+ L(0.5),
+ L(1.66666666666666666666666666666666683E-01),
+ L(4.16666666666666666666654902320001674E-02),
+ L(8.33333333333333333333314659767198461E-03),
+ L(1.38888888889899438565058018857254025E-03),
+ L(1.98412698413981650382436541785404286E-04),
};
-long double
-__ieee754_expl (long double x)
+_Float128
+__ieee754_expl (_Float128 x)
{
/* Check for usual case. */
if (isless (x, himark) && isgreater (x, lomark))
{
int tval1, tval2, unsafe, n_i;
- long double x22, n, t, result, xl;
+ _Float128 x22, n, t, result, xl;
union ieee854_long_double ex2_u, scale_u;
fenv_t oldenv;
@@ -185,13 +187,14 @@ __ieee754_expl (long double x)
ex2_u.ieee.exponent += n_i >> unsafe;
/* Compute scale = 2^n_1. */
- scale_u.d = 1.0L;
+ scale_u.d = 1;
scale_u.ieee.exponent += n_i - (n_i >> unsafe);
/* Approximate e^x2 - 1, using a seventh-degree polynomial,
with maximum error in [-2^-16-2^-53,2^-16+2^-53]
less than 4.8e-39. */
x22 = x + x*x*(P1+x*(P2+x*(P3+x*(P4+x*(P5+x*P6)))));
+ math_force_eval (x22);
/* Return result. */
fesetenv (&oldenv);