diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1997-04-30 15:51:34 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1997-04-30 15:51:34 +0000 |
| commit | 779ae82ecdf88b7ed7c1f00d3ed3a639671c3c8d (patch) | |
| tree | 287afe5ef732d76109129a142c5840cc42a2b34a /math/libm-test.c | |
| parent | a12ea214dbc999b98ab5ed4e53fb0089cf5e183a (diff) | |
| download | glibc-cvs/libc-970501.tar.xz glibc-cvs/libc-970501.zip | |
Update.cvs/libc-ud-970430cvs/libc-970619cvs/libc-970618cvs/libc-970617cvs/libc-970616cvs/libc-970615cvs/libc-970614cvs/libc-970613cvs/libc-970612cvs/libc-970611cvs/libc-970610cvs/libc-970609cvs/libc-970608cvs/libc-970607cvs/libc-970606cvs/libc-970605cvs/libc-970604cvs/libc-970603cvs/libc-970602cvs/libc-970601cvs/libc-970531cvs/libc-970530cvs/libc-970529cvs/libc-970528cvs/libc-970527cvs/libc-970526cvs/libc-970525cvs/libc-970524cvs/libc-970523cvs/libc-970522cvs/libc-970521cvs/libc-970520cvs/libc-970519cvs/libc-970518cvs/libc-970517cvs/libc-970516cvs/libc-970515cvs/libc-970514cvs/libc-970513cvs/libc-970512cvs/libc-970511cvs/libc-970510cvs/libc-970509cvs/libc-970508cvs/libc-970507cvs/libc-970506cvs/libc-970505cvs/libc-970504cvs/libc-970503cvs/libc-970502cvs/libc-970501
1997-04-30 17:35 Ulrich Drepper <drepper@cygnus.com>
* math/libm-test.c: Implement test for exceptions.
Partly due to Andreas Jaeger.
(csin_test): New function.
* sysdeps/libm-i387/s_cexp.S: Raise correct exceptions.
* sysdeps/libm-i387/s_cexpf.S: Likewise.
* sysdeps/libm-i387/s_cexpl.S: Likewise.
* sysdeps/libm-ieee754/s_ccos.c: Likewise.
* sysdeps/libm-ieee754/s_ccosf.c: Likewise.
* sysdeps/libm-ieee754/s_ccosl.c: Likewise.
* sysdeps/libm-ieee754/s_ccosh.c: Likewise.
* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
* sysdeps/libm-ieee754/s_cexp.c: Likewise.
* sysdeps/libm-ieee754/s_cexpf.c: Likewise.
* sysdeps/libm-ieee754/s_cexpl.c: Likewise.
* sysdeps/libm-ieee754/s_csinh.c: Likewise.
* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
* sysdeps/libm-ieee754/s_csinhl.c: Likewise.
* sysdeps/libm-ieee754/s_ctanh.c: Likewise.
* sysdeps/libm-ieee754/s_ctanhf.c: Likewise.
* sysdeps/libm-ieee754/s_ctanhl.c: Likewise.
* sysdeps/libm-ieee754/s_ccosh.c: Correct computation.
* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.
* sysdeps/libm-ieee754/s_csinh.c: Likewise.
* sysdeps/libm-ieee754/s_csinhf.c: Likewise.
* sysdeps/libm-ieee754/s_csinhl.c: Likewise.
* sysdeps/libm-ieee754/s_csin.c: Rewrite.
* sysdeps/libm-ieee754/s_csinf.c: Likewise.
* sysdeps/libm-ieee754/s_csinl.c: Likewise.
* stdlib/random_r.c (__srandom_r): Don't use seed 0. Use 1 in this
case.
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Use notation
for local label.
* time/strftime.c (add): Respect `0' padding flag.
Reported by Richard Stallman <rms@gnu.ai.mit.edu>.
1997-04-30 15:46 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (start-installed-name): Define here, not in csu/Makefile.
Use in +link macro.
* csu/Makefile (distribute): Add abi-note.S and abi-tag.h.
(start-installed-name): Don't define here.
When ELF generate file named by start-installed-name from start.o
and abi-note.o.
* csu/abi-note.S: New file.
* sysdeps/stub/abi-tag.h: New file.
* sysdpes/unix/sysv/linux/abi-tag.h: New file.
Patches by Roland McGrath <roland@gnu.ai.mit.edu>.
1997-04-30 01:32 Ulrich Drepper <drepper@cygnus.com>
* manual/stdio.texi: Use @vtable where possible.
Add TeX version of @multitable since texi2dvi cannot handle them
correct in the moment.
* po/de.po: Update.
1997-04-29 21:06 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig: Don't set cross-compiling based on $(BUILD_CC) != $(CC).
* config.make.in: Set cross-compiling from configure result.
* configure.in: Emit definition of `cross_compiling'.
Patches by Marcus G. Daniels <marcus@cathcart.sysc.pdx.edu>.
1997-04-27 21:50 Philip Blundell <pjb27@cam.ac.uk>
* sysdeps/unix/sysv/linux/net/route.h (struct in6_rtmsg): Use
correct `int' sizes for struct members.
1997-04-29 19:14 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-i387/e_powf.S Generate invalid exception correctly.
* sysdeps/libm-i387/e_pow.S: Likewise.
* sysdeps/libm-i387/e_powl.S: Likewise.
1997-04-23 10:08 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* math/fenv.h: Correct typos.
1997-04-28 10:04 Richard Henderson <rth@tamu.edu>
* sysdeps/unix/sysv/linux/alpha/clone.S: Save the function argument
in t0 rather than a4 to avoid it being clobbered.
1997-04-27 23:52 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/summary.awk: Recognize @defmumblex.
* manual/signal.texi (Miscellaneous Signals): Use @deftypevrx for
second description header.
1997-04-27 23:29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi (Floating-Point Classes): Don't indent text,
makeinfo doesn't like that.
1997-04-27 20:52 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* malloc/obstack.h (obstack_specify_allocation_with_arg,
obstack_chunkfun, obstack_freefun): Fix casts.
1997-04-27 18:21 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/xtract-typefun.awk: Allow names with only one character.
1997-04-26 14:16 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/netinet/ip_fw.h: Use <netinet/ip_icmp.h>
not <netinet/icmp.h>.
Reported by Michael Deutschmann <ldeutsch@mail.netshop.net>.
1997-04-25 12:31 Ulrich Drepper <drepper@cygnus.com>
* csu/Makefile ($(objpfx)initfini.s): Add CPPFLAGS, CFLAGS and -g0
to command line of compiler.
Patch by Marcus G. Daniels <marcus@sysc.pdx.edu>.
* sysdeps/generic/sigset.h (__sigandset, __sigorset): Fix typos.
Patch by Marcus G. Daniels <marcus@sysc.pdx.edu>.
* signal/signal.h (_sys_siglist, sys_siglist): Use _NSIG, not NSIG
in declaration.
Patch by Michael Widenius <monty@tcx.se>.
* time/strptime.c (strptime_internal): Fix %I format specifier
being off by one.
Patch by Mark Kettenis <kettenis@phys.uva.nl>.
1997-04-24 12:18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/lcong48_r.c: Include <limits.h>.
* stdlib/seed48_r.c: Likewise.
* stdio-common/printf_size.c (printf_size): Correct type of
`units' and make robust against future changes.
1997-04-23 18:58 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/libm-ieee754/s_cproj.c: Use isfinite instead of finite.
* sysdeps/libm-ieee754/s_cprojl.c: Likewise.
* sysdeps/libm-ieee754/s_cprojf.c: Likewise.
1997-04-23 18:53 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi, manual/math.texi: Use @defmumblex for
additional description headers.
* manual/xtract-typefun.awk: Recognize them.
1997-04-22 15:58 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* stdio-common/printf_size.c (printf_size): Correct size of array
units.
Diffstat (limited to 'math/libm-test.c')
| -rw-r--r-- | math/libm-test.c | 1167 |
1 files changed, 863 insertions, 304 deletions
diff --git a/math/libm-test.c b/math/libm-test.c index 72c27b16ca..ccb8aa80d5 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -70,6 +70,7 @@ #include <complex.h> #include <math.h> #include <float.h> +#include <fenv.h> #include <errno.h> #include <stdlib.h> @@ -87,9 +88,6 @@ #define PRINT 1 #define NO_PRINT 0 -#define TEST_EXCEPTION(test) do {} while (0); -/* As long as no exception code is available prevent warnings. */ -#define UNUSED __attribute__ ((unused)) static int noErrors; @@ -155,6 +153,9 @@ random_value (MATHTYPE min_value, MATHTYPE max_value) if ((x <= min_value) || (x >= max_value) || !isfinite (x)) x = (max_value - min_value) / 2 + min_value; + /* Make sure the RNG has no influence on the exceptions. */ + feclearexcept (FE_ALL_EXCEPT); + return x; } @@ -173,6 +174,84 @@ random_less (MATHTYPE max_value) } +/* Test whether a given exception was raised. */ +static void +test_single_exception (const char *test_name, + short int exception, + short int exc_flag, + fexcept_t fe_flag, + const char *flag_name) +{ + if (exception & exc_flag) + { + if (fetestexcept (fe_flag)) + { + if (verbose > 2) + printf ("Pass: %s:\nException \"%s\" set\n", test_name, flag_name); + } + else + { + if (verbose) + printf ("Fail: %s:\nException \"%s\" not set\n", + test_name, flag_name); + ++noErrors; + } + } + else + { + if (fetestexcept (fe_flag)) + { + if (verbose) + printf ("Fail: %s:\nException \"%s\" set\n", + test_name, flag_name); + ++noErrors; + } + else + { + if (verbose > 2) + printf ("Pass: %s:\nException \"%s\" not set\n", + test_name, flag_name); + } + } +} + + +/* Test whether exception given by EXCEPTION are raised. */ +static void +test_not_exception (const char *test_name, short int exception) +{ +#ifdef FE_DIVBYZERO + if ((exception & FE_DIVBYZERO) == 0) + test_single_exception (test_name, exception, + DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO, + "Divide by zero"); +#endif +#ifdef FE_INVALID + if ((exception & FE_INVALID) == 0) + test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID, + "Invalid operation"); +#endif + feclearexcept (FE_ALL_EXCEPT); +} + + +/* Test whether exceptions given by EXCEPTION are raised. */ +static void +test_exceptions (const char *test_name, short int exception) +{ +#ifdef FE_DIVBYZERO + test_single_exception (test_name, exception, + DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO, + "Divide by zero"); +#endif +#ifdef FE_INVALID + test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID, + "Invalid operation"); +#endif + feclearexcept (FE_ALL_EXCEPT); +} + + /* Test if two floating point numbers are equal. */ static int check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff) @@ -327,6 +406,7 @@ check (const char *test_name, MATHTYPE computed, MATHTYPE expected) MATHTYPE diff; int result; + test_exceptions (test_name, NO_EXCEPTION); result = check_equal (computed, expected, 0, &diff); output_result (test_name, result, computed, expected, diff, PRINT, PRINT); @@ -340,6 +420,7 @@ check_ext (const char *test_name, MATHTYPE computed, MATHTYPE expected, MATHTYPE diff; int result; + test_exceptions (test_name, NO_EXCEPTION); result = check_equal (computed, expected, 0, &diff); output_result_ext (test_name, result, computed, expected, diff, parameter, PRINT, PRINT); @@ -347,12 +428,27 @@ check_ext (const char *test_name, MATHTYPE computed, MATHTYPE expected, static void +check_exc (const char *test_name, MATHTYPE computed, MATHTYPE expected, + short exception) +{ + MATHTYPE diff; + int result; + + test_exceptions (test_name, exception); + result = check_equal (computed, expected, 0, &diff); + output_result (test_name, result, + computed, expected, diff, PRINT, PRINT); +} + + +static void check_eps (const char *test_name, MATHTYPE computed, MATHTYPE expected, MATHTYPE epsilon) { MATHTYPE diff; int result; + test_exceptions (test_name, NO_EXCEPTION); result = check_equal (computed, expected, epsilon, &diff); output_result (test_name, result, computed, expected, diff, PRINT, PRINT); @@ -362,6 +458,7 @@ check_eps (const char *test_name, MATHTYPE computed, MATHTYPE expected, static void check_bool (const char *test_name, int computed) { + test_exceptions (test_name, NO_EXCEPTION); output_result_bool (test_name, computed); } @@ -372,6 +469,8 @@ check_long (const char *test_name, long int computed, long int expected) long int diff = computed - expected; int result = diff == 0; + test_exceptions (test_name, NO_EXCEPTION); + if (result) { if (verbose > 2) @@ -401,6 +500,8 @@ check_longlong (const char *test_name, long long int computed, long long int diff = computed - expected; int result = diff == 0; + test_exceptions (test_name, NO_EXCEPTION); + if (result) { if (verbose > 2) @@ -426,14 +527,25 @@ check_longlong (const char *test_name, long long int computed, static void check_isnan (const char *test_name, MATHTYPE computed) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue (test_name, isnan (computed), computed); } static void check_isnan_exc (const char *test_name, MATHTYPE computed, - short exception UNUSED) + short exception) { + test_exceptions (test_name, exception); + output_isvalue (test_name, isnan (computed), computed); +} + + +static void +check_isnan_maybe_exc (const char *test_name, MATHTYPE computed, + short exception) +{ + test_not_exception (test_name, exception); output_isvalue (test_name, isnan (computed), computed); } @@ -442,6 +554,7 @@ static void check_isnan_ext (const char *test_name, MATHTYPE computed, MATHTYPE parameter) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue_ext (test_name, isnan (computed), computed, parameter); } @@ -450,6 +563,7 @@ check_isnan_ext (const char *test_name, MATHTYPE computed, static void check_isinfp (const char *test_name, MATHTYPE computed) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue (test_name, (ISINF (computed) == +1), computed); } @@ -458,6 +572,7 @@ static void check_isinfp_ext (const char *test_name, MATHTYPE computed, MATHTYPE parameter) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue_ext (test_name, (ISINF (computed) == +1), computed, parameter); } @@ -465,8 +580,9 @@ check_isinfp_ext (const char *test_name, MATHTYPE computed, /* Tests if computed is +Inf */ static void check_isinfp_exc (const char *test_name, MATHTYPE computed, - int exception UNUSED) + int exception) { + test_exceptions (test_name, exception); output_isvalue (test_name, (ISINF (computed) == +1), computed); } @@ -474,6 +590,7 @@ check_isinfp_exc (const char *test_name, MATHTYPE computed, static void check_isinfn (const char *test_name, MATHTYPE computed) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue (test_name, (ISINF (computed) == -1), computed); } @@ -482,6 +599,7 @@ static void check_isinfn_ext (const char *test_name, MATHTYPE computed, MATHTYPE parameter) { + test_exceptions (test_name, NO_EXCEPTION); output_isvalue_ext (test_name, (ISINF (computed) == -1), computed, parameter); } @@ -489,8 +607,9 @@ check_isinfn_ext (const char *test_name, MATHTYPE computed, /* Tests if computed is -Inf */ static void check_isinfn_exc (const char *test_name, MATHTYPE computed, - int exception UNUSED) + int exception) { + test_exceptions (test_name, exception); output_isvalue (test_name, (ISINF (computed) == -1), computed); } @@ -507,7 +626,7 @@ acos_test (void) check ("acos (1) == 0", FUNC(acos) (1), 0); x = random_greater (1); - check_isnan_exc ("acos (x) == NaN + invalid exception for |x| > 1", + check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1", FUNC(acos) (x), INVALID_EXCEPTION); } @@ -533,7 +652,7 @@ asin_test (void) check ("asin (0) == 0", FUNC(asin) (0), 0); x = random_greater (1); - check_isnan_exc ("asin x == NaN + invalid exception for |x| > 1", + check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1", FUNC(asin) (x), INVALID_EXCEPTION); } @@ -882,14 +1001,14 @@ ldexp_test (void) static void log_test (void) { - check_isinfn_exc ("log (+0) == -inf", FUNC(log) (0), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfn_exc ("log (-0) == -inf", FUNC(log) (minus_zero), - DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log (+0) == -inf plus divide-by-zero exception", + FUNC(log) (0), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log (-0) == -inf plus divide-by-zero exception", + FUNC(log) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION); check ("log (1) == 0", FUNC(log) (1), 0); - check_isnan_exc ("log (x) == NaN plus divide-by-zero exception if x < 0", + check_isnan_exc ("log (x) == NaN plus invalid exception if x < 0", FUNC(log) (-1), INVALID_EXCEPTION); check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty)); @@ -905,14 +1024,14 @@ log_test (void) static void log10_test (void) { - check_isinfn_exc ("log10 (+0) == -inf", FUNC(log10) (0), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfn_exc ("log10 (-0) == -inf", FUNC(log10) (minus_zero), - DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log10 (+0) == -inf plus divide-by-zero exception", + FUNC(log10) (0), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log10 (-0) == -inf plus divide-by-zero exception", + FUNC(log10) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION); check ("log10 (1) == +0", FUNC(log10) (1), 0); - check_isnan_exc ("log10 (x) == NaN plus divide-by-zero exception if x < 0", + check_isnan_exc ("log10 (x) == NaN plus invalid exception if x < 0", FUNC(log10) (-1), INVALID_EXCEPTION); check_isinfp ("log10 (+inf) == +inf", FUNC(log10) (plus_infty)); @@ -935,9 +1054,9 @@ log1p_test (void) check ("log1p (+0) == +0", FUNC(log1p) (0), 0); check ("log1p (-0) == -0", FUNC(log1p) (minus_zero), minus_zero); - check_isinfn_exc ("log1p (-1) == -inf", FUNC(log1p) (-1), - DIVIDE_BY_ZERO_EXCEPTION); - check_isnan_exc ("log1p (x) == NaN plus divide-by-zero exception if x < -1", + check_isinfn_exc ("log1p (-1) == -inf plus divide-by-zero exception", + FUNC(log1p) (-1), DIVIDE_BY_ZERO_EXCEPTION); + check_isnan_exc ("log1p (x) == NaN plus invalid exception if x < -1", FUNC(log1p) (-2), INVALID_EXCEPTION); check_isinfp ("log1p (+inf) == +inf", FUNC(log1p) (plus_infty)); @@ -951,14 +1070,14 @@ log1p_test (void) static void log2_test (void) { - check_isinfn_exc ("log2 (+0) == -inf", FUNC(log2) (0), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfn_exc ("log2 (-0) == -inf", FUNC(log2) (minus_zero), - DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log2 (+0) == -inf plus divide-by-zero exception", + FUNC(log2) (0), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("log2 (-0) == -inf plus divide-by-zero exception", + FUNC(log2) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION); check ("log2 (1) == +0", FUNC(log2) (1), 0); - check_isnan_exc ("log2 (x) == NaN plus divide-by-zero exception if x < 0", + check_isnan_exc ("log2 (x) == NaN plus invalid exception if x < 0", FUNC(log2) (-1), INVALID_EXCEPTION); check_isinfp ("log2 (+inf) == +inf", FUNC(log2) (plus_infty)); @@ -1254,41 +1373,41 @@ pow_test (void) x = random_greater (0.0); check_isnan_ext ("pow (x, NaN) == NaN", FUNC(pow) (x, nan_value), x); - check_isnan_exc ("pow (+1, +inf) == NaN", FUNC(pow) (1, plus_infty), - INVALID_EXCEPTION); - check_isnan_exc ("pow (-1, +inf) == NaN", FUNC(pow) (-1, plus_infty), - INVALID_EXCEPTION); - check_isnan_exc ("pow (+1, -inf) == NaN", FUNC(pow) (1, minus_infty), - INVALID_EXCEPTION); - check_isnan_exc ("pow (-1, -inf) == NaN", FUNC(pow) (-1, minus_infty), - INVALID_EXCEPTION); - - check_isnan_exc ("pow (-0.1, 1.1) == NaN", FUNC(pow) (-0.1, 1.1), - INVALID_EXCEPTION); - check_isnan_exc ("pow (-0.1, -1.1) == NaN", FUNC(pow) (-0.1, -1.1), - INVALID_EXCEPTION); - check_isnan_exc ("pow (-10.1, 1.1) == NaN", FUNC(pow) (-10.1, 1.1), - INVALID_EXCEPTION); - check_isnan_exc ("pow (-10.1, -1.1) == NaN", FUNC(pow) (-10.1, -1.1), - INVALID_EXCEPTION); - - check_isinfp_exc ("pow (+0, -1) == +inf", FUNC(pow) (0, -1), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfp_exc ("pow (+0, -11) == +inf", FUNC(pow) (0, -11), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfn_exc ("pow (-0, -1) == -inf", FUNC(pow) (minus_zero, -1), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfn_exc ("pow (-0, -11) == -inf", FUNC(pow) (minus_zero, -11), - DIVIDE_BY_ZERO_EXCEPTION); - - check_isinfp_exc ("pow (+0, -2) == +inf", FUNC(pow) (0, -2), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfp_exc ("pow (+0, -11.1) == +inf", FUNC(pow) (0, -11.1), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfp_exc ("pow (-0, -2) == +inf", FUNC(pow) (minus_zero, -2), - DIVIDE_BY_ZERO_EXCEPTION); - check_isinfp_exc ("pow (-0, -11.1) == +inf", FUNC(pow) (minus_zero, -11.1), - DIVIDE_BY_ZERO_EXCEPTION); + check_isnan_exc ("pow (+1, +inf) == NaN plus invalid exception", + FUNC(pow) (1, plus_infty), INVALID_EXCEPTION); + check_isnan_exc ("pow (-1, +inf) == NaN plus invalid exception", + FUNC(pow) (-1, plus_infty), INVALID_EXCEPTION); + check_isnan_exc ("pow (+1, -inf) == NaN plus invalid exception", + FUNC(pow) (1, minus_infty), INVALID_EXCEPTION); + check_isnan_exc ("pow (-1, -inf) == NaN plus invalid exception", + FUNC(pow) (-1, minus_infty), INVALID_EXCEPTION); + + check_isnan_exc ("pow (-0.1, 1.1) == NaN plus invalid exception", + FUNC(pow) (-0.1, 1.1), INVALID_EXCEPTION); + check_isnan_exc ("pow (-0.1, -1.1) == NaN plus invalid exception", + FUNC(pow) (-0.1, -1.1), INVALID_EXCEPTION); + check_isnan_exc ("pow (-10.1, 1.1) == NaN plus invalid exception", + FUNC(pow) (-10.1, 1.1), INVALID_EXCEPTION); + check_isnan_exc ("pow (-10.1, -1.1) == NaN plus invalid exception", + FUNC(pow) (-10.1, -1.1), INVALID_EXCEPTION); + + check_isinfp_exc ("pow (+0, -1) == +inf plus divide-by-zero exception", + FUNC(pow) (0, -1), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfp_exc ("pow (+0, -11) == +inf plus divide-by-zero exception", + FUNC(pow) (0, -11), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("pow (-0, -1) == -inf plus divide-by-zero exception", + FUNC(pow) (minus_zero, -1), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfn_exc ("pow (-0, -11) == -inf plus divide-by-zero exception", + FUNC(pow) (minus_zero, -11), DIVIDE_BY_ZERO_EXCEPTION); + + check_isinfp_exc ("pow (+0, -2) == +inf plus divide-by-zero exception", + FUNC(pow) (0, -2), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfp_exc ("pow (+0, -11.1) == +inf plus divide-by-zero exception", + FUNC(pow) (0, -11.1), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfp_exc ("pow (-0, -2) == +inf plus divide-by-zero exception", + FUNC(pow) (minus_zero, -2), DIVIDE_BY_ZERO_EXCEPTION); + check_isinfp_exc ("pow (-0, -11.1) == +inf plus divide-by-zero exception", + FUNC(pow) (minus_zero, -11.1), DIVIDE_BY_ZERO_EXCEPTION); check ("pow (+0, 1) == +0", FUNC(pow) (0, 1), 0); check ("pow (+0, 11) == +0", FUNC(pow) (0, 11), 0); @@ -1622,12 +1741,46 @@ cexp_test (void) check ("real(cexp(-inf - 0i)) = 0", __real__ result, 0); check ("imag(cexp(-inf - 0i)) = -0", __imag__ result, minus_zero); + result = FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty)); + check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty)); + check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty)); + check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty)); + check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty)); - check_isnan ("real(cexp(x + i inf)) = NaN", __real__ result); - check_isnan ("imag(cexp(x + i inf)) = NaN", __imag__ result); + check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty)); + check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception", + __imag__ result); result = FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty)); - check_isnan ("real(cexp(x - i inf)) = NaN", __real__ result); - check_isnan ("imag(cexp(x - i inf)) = NaN", __imag__ result); + check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception", + __imag__ result); + result = FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty)); + check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception", + __real__ result, FE_INVALID); + check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result); |
