diff options
Diffstat (limited to 'libm')
-rw-r--r-- | libm/s_lrint.c | 20 | ||||
-rw-r--r-- | libm/s_nextafter.c | 9 | ||||
-rw-r--r-- | libm/w_j0f.c | 2 |
3 files changed, 17 insertions, 14 deletions
diff --git a/libm/s_lrint.c b/libm/s_lrint.c index 09800d8de..2a8db9fbe 100644 --- a/libm/s_lrint.c +++ b/libm/s_lrint.c @@ -49,19 +49,13 @@ lrint (double x) if (_j0 < 20) { - if (_j0 < -1) - return 0; - else - { - w = two52[sx] + x; - t = w - two52[sx]; - EXTRACT_WORDS (i0, i1, t); - _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - i0 &= 0xfffff; - i0 |= 0x100000; - - result = i0 >> (20 - _j0); - } + w = two52[sx] + x; + t = w - two52[sx]; + EXTRACT_WORDS (i0, i1, t); + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + i0 &= 0xfffff; + i0 |= 0x100000; + result = (_j0 < 0 ? 0 : i0 >> (20 - _j0)); } else if (_j0 < (int32_t) (8 * sizeof (long int)) - 1) { diff --git a/libm/s_nextafter.c b/libm/s_nextafter.c index 73a8ab2be..7eb4ec46e 100644 --- a/libm/s_nextafter.c +++ b/libm/s_nextafter.c @@ -18,6 +18,7 @@ #include "math.h" #include "math_private.h" +#include <float.h> double nextafter(double x, double y) { @@ -68,5 +69,13 @@ double nextafter(double x, double y) return x; } libm_hidden_def(nextafter) +#if LDBL_MANT_DIG == DBL_MANT_DIG strong_alias_untyped(nextafter, nexttoward) libm_hidden_def(nexttoward) +#else +double nexttoward(double x, long double y) +{ + return nextafter(x, y); +} +libm_hidden_def(nexttoward) +#endif diff --git a/libm/w_j0f.c b/libm/w_j0f.c index 89821bc98..496e098cd 100644 --- a/libm/w_j0f.c +++ b/libm/w_j0f.c @@ -63,6 +63,6 @@ y0f (float x) return __kernel_standard_f (x, x, 135); } # endif /* __UCLIBC_HAS_FENV__ */ - return (float) __ieee754_y0f ((double) x); + return (float) __ieee754_y0 ((double) x); } #endif /* __DO_XSI_MATH__ */ |