aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
Diffstat (limited to 'math')
-rw-r--r--math/Makefile4
-rw-r--r--math/libm-test.inc10
-rw-r--r--math/math_private.h3
-rw-r--r--math/test-misc.c22
4 files changed, 37 insertions, 2 deletions
diff --git a/math/Makefile b/math/Makefile
index cbc2f4c4..2c17529 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -53,11 +53,11 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
w_tgamma w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \
w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \
s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc \
- s_remquo s_log2 e_exp2 s_round s_nearbyint s_sincos \
+ s_remquo e_log2 e_exp2 s_round s_nearbyint s_sincos \
conj cimag creal cabs carg s_cexp s_csinh s_ccosh s_clog \
s_catan s_casin s_ccos s_csin s_ctan s_ctanh s_cacos \
s_casinh s_cacosh s_catanh s_csqrt s_cpow s_cproj s_clog10 \
- s_fma s_lrint s_llrint s_lround s_llround e_exp10
+ s_fma s_lrint s_llrint s_lround s_llround e_exp10 w_log2
dbl-only-routines := branred doasin dosincos halfulp mpa mpatan2 \
mpatan mpexp mplog mpsqrt mptan sincos32 slowexp \
slowpow
diff --git a/math/libm-test.inc b/math/libm-test.inc
index c9ba1f9..481c395 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -120,6 +120,7 @@
#include <math.h>
#include <float.h>
#include <fenv.h>
+#include <limits.h>
#include <errno.h>
#include <stdlib.h>
@@ -2800,6 +2801,8 @@ ilogb_test (void)
TEST_f_i (ilogb, 0.0, FP_ILOGB0, EXCEPTIONS_OK);
TEST_f_i (ilogb, nan_value, FP_ILOGBNAN, EXCEPTIONS_OK);
+ TEST_f_i (ilogb, plus_infty, INT_MAX, EXCEPTIONS_OK);
+ TEST_f_i (ilogb, minus_infty, INT_MAX, EXCEPTIONS_OK);
END (ilogb);
}
@@ -3302,6 +3305,13 @@ llround_test (void)
/* 0x100000000000000 */
TEST_f_L (llround, 72057594037927936.0, 72057594037927936LL);
+#ifndef TEST_FLOAT
+ /* 0x100000000 */
+ TEST_f_L (llround, 4294967295.5, 4294967296LL);
+ /* 0x200000000 */
+ TEST_f_L (llround, 8589934591.5, 8589934592LL);
+#endif
+
END (llround);
}
diff --git a/math/math_private.h b/math/math_private.h
index 19404d0..593cb7a 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -169,6 +169,7 @@ extern double __ieee754_gamma_r (double,int *);
extern double __ieee754_lgamma (double);
extern double __ieee754_gamma (double);
extern double __ieee754_log10 (double);
+extern double __ieee754_log2 (double);
extern double __ieee754_sinh (double);
extern double __ieee754_hypot (double,double);
extern double __ieee754_j0 (double);
@@ -211,6 +212,7 @@ extern float __ieee754_gammaf_r (float,int *);
extern float __ieee754_lgammaf (float);
extern float __ieee754_gammaf (float);
extern float __ieee754_log10f (float);
+extern float __ieee754_log2f (float);
extern float __ieee754_sinhf (float);
extern float __ieee754_hypotf (float,float);
extern float __ieee754_j0f (float);
@@ -250,6 +252,7 @@ extern long double __ieee754_gammal_r (long double,int *);
extern long double __ieee754_lgammal (long double);
extern long double __ieee754_gammal (long double);
extern long double __ieee754_log10l (long double);
+extern long double __ieee754_log2l (long double);
extern long double __ieee754_sinhl (long double);
extern long double __ieee754_hypotl (long double,long double);
extern long double __ieee754_j0l (long double);
diff --git a/math/test-misc.c b/math/test-misc.c
index ba34f92..5a78574 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -79,6 +79,28 @@ main (void)
}
puts ("ok");
}
+
+ for (i = LDBL_MIN_EXP, x = LDBL_MIN; i >= LDBL_MIN_EXP - LDBL_MANT_DIG + 1;
+ --i, x /= 2.0L)
+ {
+ printf ("2^%d: ", i);
+
+ r = frexpl (x, &e);
+ if (r != 0.5L)
+ {
+ printf ("mantissa incorrect: %.20La\n", r);
+ result = 1;
+ continue;
+ }
+ if (e != i)
+ {
+ printf ("exponent wrong %d (%.20Lg)\n", e, x);
+ result = 1;
+ continue;
+ }
+ puts ("ok");
+ }
+
}
# endif