diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-12-07 03:25:24 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-12-07 03:25:24 +0000 |
commit | 64b02fd2f5fd5d2e2b7187b5e982fa6b59587500 (patch) | |
tree | 8b833557f08e0d9088bfbeb20af3389680cdc87f /math | |
parent | Update. (diff) | |
download | glibc-64b02fd2f5fd5d2e2b7187b5e982fa6b59587500.tar.gz glibc-64b02fd2f5fd5d2e2b7187b5e982fa6b59587500.tar.bz2 glibc-64b02fd2f5fd5d2e2b7187b5e982fa6b59587500.zip |
Update.
2003-12-06 Ulrich Drepper <drepper@redhat.com>
* math/Makefile (tests): Add bug-nextafter.
* math/bug-nextafter.c: New file.
* sysdeps/generic/s_nextafter.c: Construct overflow value correctly.
* sysdeps/ieee754/flt-32/s_nextafterf.c: Likewise.
* math/libm-test.inc (nextafter_test): Add test for overflow after
+/-FLT_MAX etc.
Diffstat (limited to 'math')
-rw-r--r-- | math/Makefile | 3 | ||||
-rw-r--r-- | math/bug-nextafter.c | 28 | ||||
-rw-r--r-- | math/libm-test.inc | 5 |
3 files changed, 35 insertions, 1 deletions
diff --git a/math/Makefile b/math/Makefile index d04269d298..b8624053a8 100644 --- a/math/Makefile +++ b/math/Makefile @@ -87,7 +87,8 @@ distribute += $(filter-out $(generated),$(long-m-yes:=.c) $(long-c-yes:=.c)) # Rules for the test suite. tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ - test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret + test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \ + bug-nextafter # We do the `long double' tests only if this data type is available and # distinct from `double'. test-longdouble-yes = test-ldouble test-ildoubl diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c new file mode 100644 index 0000000000..8aa849df19 --- /dev/null +++ b/math/bug-nextafter.c @@ -0,0 +1,28 @@ +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <stdio.h> + +int +main (void) +{ + int result = 0; + + float i = INFINITY; + float m = FLT_MAX; + if (nextafterf (m, i) != i) + { + puts ("nextafterf failed"); + ++result; + } + + double di = INFINITY; + double dm = DBL_MAX; + if (nextafter (dm, di) != di) + { + puts ("nextafter failed"); + ++result; + } + + return result; +} diff --git a/math/libm-test.inc b/math/libm-test.inc index 69752e00d5..38386c1ed5 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -3437,6 +3437,11 @@ nextafter_test (void) TEST_ff_f (nextafter, 1.1L, nan_value, nan_value); TEST_ff_f (nextafter, nan_value, nan_value, nan_value); + FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX, + LDBL_MAX, DBL_MAX, FLT_MAX); + TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty); + TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty); + #ifdef TEST_LDOUBLE // XXX Enable once gcc is fixed. //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L); |