This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 6/6] Make shared ldbl files more shareable.
Use integer constants when equivalent, and use ldouble_t
to enable sharing with the _Float128 variants.
* math/e_exp2l.c (__ieee754_exp2l): Replace long double
with ldouble_t, and use integer constants as appropriate.
* math/s_fdiml.c: (__fdiml): Likewise.
* math/k_rem_pio2l.c: (__kernel_rem_pio2l): Replace
long double with ldouble_t.
* math/s_ldexpl.c: (__ldexpl): Likewise.
* math/s_nextdownl.c: (__nextdownl): Likewise.
* math/s_fmaxl.c: (__fmaxl): Likewise, and include
math_private.h for alias.
* math/s_fminl.c: (__fminl): Likewise.
---
math/e_exp2l.c | 20 ++++++++++----------
math/k_rem_pio2l.c | 2 +-
math/s_fdiml.c | 10 ++++++----
math/s_fmaxl.c | 5 +++--
math/s_fminl.c | 5 +++--
math/s_ldexpl.c | 3 ++-
math/s_nextdownl.c | 4 ++--
7 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/math/e_exp2l.c b/math/e_exp2l.c
index b1ea7c7..5111a95 100644
--- a/math/e_exp2l.c
+++ b/math/e_exp2l.c
@@ -27,20 +27,20 @@
# define LDBL_EPSILON 0x1p-106L
#endif
-long double
-__ieee754_exp2l (long double x)
+ldouble_t
+__ieee754_exp2l (ldouble_t x)
{
- if (__glibc_likely (isless (x, (long double) LDBL_MAX_EXP)))
+ if (__glibc_likely (isless (x, (ldouble_t) LDBL_MAX_EXP)))
{
- if (__builtin_expect (isgreaterequal (x, (long double) (LDBL_MIN_EXP
- - LDBL_MANT_DIG
- - 1)), 1))
+ if (__builtin_expect (isgreaterequal (x, (ldouble_t) (LDBL_MIN_EXP
+ - LDBL_MANT_DIG
+ - 1)), 1))
{
int intx = (int) x;
- long double fractx = x - intx;
- long double result;
- if (fabsl (fractx) < LDBL_EPSILON / 4.0L)
- result = __scalbnl (1.0L + fractx, intx);
+ ldouble_t fractx = x - intx;
+ ldouble_t result;
+ if (fabsl (fractx) < LDBL_EPSILON / 4)
+ result = __scalbnl (1 + fractx, intx);
else
result = __scalbnl (__ieee754_expl (M_LN2l * fractx), intx);
math_check_force_underflow_nonneg (result);
diff --git a/math/k_rem_pio2l.c b/math/k_rem_pio2l.c
index 01bf158..d9613ed 100644
--- a/math/k_rem_pio2l.c
+++ b/math/k_rem_pio2l.c
@@ -4,7 +4,7 @@
#include <errno.h>
int
-__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec,
+__kernel_rem_pio2l (ldouble_t *x, ldouble_t *y, int e0, int nx, int prec,
const int *ipio2)
{
fputs ("__kernel_rem_pio2l not implemented\n", stderr);
diff --git a/math/s_fdiml.c b/math/s_fdiml.c
index 4a1f672..38a2687 100644
--- a/math/s_fdiml.c
+++ b/math/s_fdiml.c
@@ -20,13 +20,15 @@
#include <errno.h>
#include <math.h>
-long double
-__fdiml (long double x, long double y)
+#include <math_private.h>
+
+ldouble_t
+__fdiml (ldouble_t x, ldouble_t y)
{
if (islessequal (x, y))
- return 0.0f;
+ return 0;
- long double r = x - y;
+ ldouble_t r = x - y;
if (isinf (r) && !isinf (x) && !isinf (y))
__set_errno (ERANGE);
diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c
index 3b22735..9536f9f 100644
--- a/math/s_fmaxl.c
+++ b/math/s_fmaxl.c
@@ -18,10 +18,11 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
-long double
-__fmaxl (long double x, long double y)
+ldouble_t
+__fmaxl (ldouble_t x, ldouble_t y)
{
return (isgreaterequal (x, y) || isnan (y)) ? x : y;
}
diff --git a/math/s_fminl.c b/math/s_fminl.c
index 84e9e51..3ca2b47 100644
--- a/math/s_fminl.c
+++ b/math/s_fminl.c
@@ -18,10 +18,11 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
-long double
-__fminl (long double x, long double y)
+ldouble_t
+__fminl (ldouble_t x, ldouble_t y)
{
return (islessequal (x, y) || isnan (y)) ? x : y;
}
diff --git a/math/s_ldexpl.c b/math/s_ldexpl.c
index 52fb093..d95708e 100644
--- a/math/s_ldexpl.c
+++ b/math/s_ldexpl.c
@@ -22,7 +22,8 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
#include <errno.h>
-long double __ldexpl(long double value, int exp)
+ldouble_t
+__ldexpl(ldouble_t value, int exp)
{
if(!isfinite(value)||value==0.0) return value + value;
value = __scalbnl(value,exp);
diff --git a/math/s_nextdownl.c b/math/s_nextdownl.c
index e7607f5..e81d255 100644
--- a/math/s_nextdownl.c
+++ b/math/s_nextdownl.c
@@ -20,8 +20,8 @@
#include <math_private.h>
/* Return the greatest floating-point number less than X. */
-long double
-__nextdownl (long double x)
+ldouble_t
+__nextdownl (ldouble_t x)
{
return -__nextupl (-x);
}
--
2.4.11