diff --git a/ChangeLog b/ChangeLog index f3b04536f6..ac2f6eb438 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2012-05-24 Joseph Myers + + * math/gen-libm-test.pl (%beautify): Add entries for underflow + exceptions. + * math/libm-test.inc ("Philosophy"): Update comment about + exception testing. + (UNDERFLOW_EXCEPTION): New macro. + (UNDERFLOW_EXCEPTION_OK): Likewise. + (UNDERFLOW_EXCEPTION_FLOAT): Likewise. + (UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise. + (UNDERFLOW_EXCEPTION_DOUBLE): Likewise. + (UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise. + (INVALID_EXCEPTION_OK): Update value. + (DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise. + (OVERFLOW_EXCEPTION_OK): Likewise. + (IGNORE_ZERO_INF_SIGN): Likewise. + (test_exceptions): Handle underflow exceptions. + (acos_test): Update for underflow exception expectations. + (cexp_test): Likewise. + (clog_test): Likewise. + (clog10_test): Likewise. + (csqrt_test): Likewise. + (ctan_test): Likewise. + (ctanh_test): Likewise. + (exp_test): Likewise. + (exp10_test): Likewise. + (exp2_test): Likewise. + (expm1_test): Likewise. + (fma_test): Likewise. + (j0_test): Likewise. + (jn_test): Likewise. + (nexttoward_test): Likewise. + (pow_test): Likewise. + (scalbn_test): Likewise. + (scalbln_test): Likewise. + (tan_test): Likewise. + (y1_test): Likewise. + * sysdeps/i386/fpu/libm-test-ulps: Update. + * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. + 2012-05-23 David S. Miller * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl index 395bb65513..2f1574763e 100755 --- a/math/gen-libm-test.pl +++ b/math/gen-libm-test.pl @@ -79,9 +79,15 @@ use vars qw ($output_dir $ulps_file); "INVALID_EXCEPTION" => "invalid exception", "DIVIDE_BY_ZERO_EXCEPTION" => "division by zero exception", "OVERFLOW_EXCEPTION" => "overflow exception", + "UNDERFLOW_EXCEPTION" => "underflow exception", + "UNDERFLOW_EXCEPTION_FLOAT" => "underflow exception for float", + "UNDERFLOW_EXCEPTION_DOUBLE" => "underflow exception for double", + "UNDERFLOW_EXCEPTION_LDOUBLE_IBM" => "underflow exception for IBM long double", "INVALID_EXCEPTION_OK" => "invalid exception allowed", "DIVIDE_BY_ZERO_EXCEPTION_OK" => "division by zero exception allowed", "OVERFLOW_EXCEPTION_OK" => "overflow exception allowed", + "UNDERFLOW_EXCEPTION_OK" => "underflow exception allowed", + "UNDERFLOW_EXCEPTION_OK_FLOAT" => "underflow exception allowed for float", "EXCEPTIONS_OK" => "exceptions allowed", "IGNORE_ZERO_INF_SIGN" => "sign of zero/inf not specified", "INVALID_EXCEPTION|IGNORE_ZERO_INF_SIGN" => "invalid exception and sign of zero/inf not specified" diff --git a/math/libm-test.inc b/math/libm-test.inc index 19c3c8ae3f..54248665d7 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -78,8 +78,8 @@ against. These implemented tests should check all cases that are specified in ISO C99. - Exception testing: At the moment only divide-by-zero, invalid and - overflow exceptions are tested. Underflow and inexact exceptions + Exception testing: At the moment only divide-by-zero, invalid, + overflow and underflow exceptions are tested. Inexact exceptions aren't checked at the moment. NaN values: There exist signalling and quiet NaNs. This implementation @@ -149,13 +149,39 @@ #define INVALID_EXCEPTION 0x1 #define DIVIDE_BY_ZERO_EXCEPTION 0x2 #define OVERFLOW_EXCEPTION 0x4 +#define UNDERFLOW_EXCEPTION 0x8 /* The next flags signals that those exceptions are allowed but not required. */ -#define INVALID_EXCEPTION_OK 0x8 -#define DIVIDE_BY_ZERO_EXCEPTION_OK 0x10 -#define OVERFLOW_EXCEPTION_OK 0x20 +#define INVALID_EXCEPTION_OK 0x10 +#define DIVIDE_BY_ZERO_EXCEPTION_OK 0x20 +#define OVERFLOW_EXCEPTION_OK 0x40 +#define UNDERFLOW_EXCEPTION_OK 0x80 #define EXCEPTIONS_OK INVALID_EXCEPTION_OK+DIVIDE_BY_ZERO_EXCEPTION_OK -/* Some special test flags, passed togther with exceptions. */ -#define IGNORE_ZERO_INF_SIGN 0x40 +/* Some special test flags, passed together with exceptions. */ +#define IGNORE_ZERO_INF_SIGN 0x100 + +/* Values underflowing only for float. */ +#ifdef TEST_FLOAT +# define UNDERFLOW_EXCEPTION_FLOAT UNDERFLOW_EXCEPTION +# define UNDERFLOW_EXCEPTION_OK_FLOAT UNDERFLOW_EXCEPTION_OK +#else +# define UNDERFLOW_EXCEPTION_FLOAT 0 +# define UNDERFLOW_EXCEPTION_OK_FLOAT 0 +#endif +/* Values underflowing only for double or types with a larger least + positive normal value. */ +#if defined TEST_FLOAT || defined TEST_DOUBLE \ + || (defined TEST_LDOUBLE && LDBL_MIN_EXP >= DBL_MIN_EXP) +# define UNDERFLOW_EXCEPTION_DOUBLE UNDERFLOW_EXCEPTION +#else +# define UNDERFLOW_EXCEPTION_DOUBLE 0 +#endif +/* Values underflowing only for IBM long double or types with a larger least + positive normal value. */ +#if defined TEST_FLOAT || (defined TEST_LDOUBLE && LDBL_MIN_EXP > DBL_MIN_EXP) +# define UNDERFLOW_EXCEPTION_LDOUBLE_IBM UNDERFLOW_EXCEPTION +#else +# define UNDERFLOW_EXCEPTION_LDOUBLE_IBM 0 +#endif /* Various constants (we must supply them precalculated for accuracy). */ #define M_PI_6l .52359877559829887307710723054658383L @@ -473,6 +499,11 @@ test_exceptions (const char *test_name, int exception) if ((exception & OVERFLOW_EXCEPTION_OK) == 0) test_single_exception (test_name, exception, OVERFLOW_EXCEPTION, FE_OVERFLOW, "Overflow"); +#endif +#ifdef FE_UNDERFLOW + if ((exception & UNDERFLOW_EXCEPTION_OK) == 0) + test_single_exception (test_name, exception, UNDERFLOW_EXCEPTION, + FE_UNDERFLOW, "Underflow"); #endif feclearexcept (FE_ALL_EXCEPT); } @@ -773,7 +804,8 @@ acos_test (void) TEST_f_f (acos, 0.5, M_PI_6l*2.0); TEST_f_f (acos, -0.5, M_PI_6l*4.0); TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L); - TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L); + /* Bug 14153: spurious exception may occur. */ + TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L, UNDERFLOW_EXCEPTION_OK_FLOAT); TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L); TEST_f_f (acos, 0x0.ffffffp0L, 3.4526698471620358760324948263873649728491e-4L); TEST_f_f (acos, -0x0.ffffffp0L, 3.1412473866050770348750401337968641476999L); @@ -2260,16 +2292,16 @@ cexp_test (void) #endif TEST_c_c (cexp, 88.75, 0.75, 2.558360358486542817001900410314204322891e38L, 2.383359453227311447654736314679677655100e38L); - TEST_c_c (cexp, -95, 0.75, 4.039714446238306526889476684000081624047e-42L, 3.763383677300535390271646960780570275931e-42L); + TEST_c_c (cexp, -95, 0.75, 4.039714446238306526889476684000081624047e-42L, 3.763383677300535390271646960780570275931e-42L, UNDERFLOW_EXCEPTION_FLOAT); #ifndef TEST_FLOAT TEST_c_c (cexp, 709.8125, 0.75, 1.355121963080879535248452862759108365762e308L, 1.262426823598609432507811340856186873507e308L); - TEST_c_c (cexp, -720, 0.75, 1.486960657116368433685753325516638551722e-313L, 1.385247284245720590980701226843815229385e-313L); + TEST_c_c (cexp, -720, 0.75, 1.486960657116368433685753325516638551722e-313L, 1.385247284245720590980701226843815229385e-313L, UNDERFLOW_EXCEPTION_DOUBLE); #endif #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 TEST_c_c (cexp, 11356.5625, 0.75, 9.052188470850960144814815984311663764287e4931L, 8.432986734191301036267148978260970230200e4931L); - TEST_c_c (cexp, -11370, 0.75, 8.631121063182211587489310508568170739592e-4939L, 8.040721827809267291427062346918413482824e-4939L); + TEST_c_c (cexp, -11370, 0.75, 8.631121063182211587489310508568170739592e-4939L, 8.040721827809267291427062346918413482824e-4939L, UNDERFLOW_EXCEPTION); #endif #ifdef TEST_FLOAT @@ -2371,7 +2403,7 @@ clog_test (void) TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L); TEST_c_c (clog, 0x1.fffffep+127L, 0x1.fffffep+127L, 89.06941264234832570836679262104313101776L, M_PI_4l); - TEST_c_c (clog, 0x1.fffffep+127L, 1.0L, 88.72283905206835305365817656031404273372L, 2.938736052218037251011746307725933020145e-39L); + TEST_c_c (clog, 0x1.fffffep+127L, 1.0L, 88.72283905206835305365817656031404273372L, 2.938736052218037251011746307725933020145e-39L, UNDERFLOW_EXCEPTION_FLOAT); TEST_c_c (clog, 0x1p-149L, 0x1p-149L, -102.9323563131518784484589700365392203592L, M_PI_4l); TEST_c_c (clog, 0x1p-147L, 0x1p-147L, -101.5460619520319878296245057936228672231L, M_PI_4l); @@ -2455,7 +2487,7 @@ clog10_test (void) TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L); TEST_c_c (clog10, 0x1.fffffep+127L, 0x1.fffffep+127L, 38.68235441693561449174780668781319348761L, M_PI4_LOG10El); - TEST_c_c (clog10, 0x1.fffffep+127L, 1.0L, 38.53183941910362389414093724045094697423L, 1.276276851248440096917018665609900318458e-39L); + TEST_c_c (clog10, 0x1.fffffep+127L, 1.0L, 38.53183941910362389414093724045094697423L, 1.276276851248440096917018665609900318458e-39L, UNDERFLOW_EXCEPTION_FLOAT); TEST_c_c (clog10, 0x1p-149L, 0x1p-149L, -44.70295435610120748924022586658721447508L, M_PI4_LOG10El); TEST_c_c (clog10, 0x1p-147L, 0x1p-147L, -44.10089436477324509881274807713822842154L, M_PI4_LOG10El); @@ -3178,7 +3210,8 @@ csqrt_test (void) #ifndef TEST_FLOAT TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 1.473094556905565378990473658199034571917e+154L, 6.101757441282702188537080005372547713595e+153L); TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 1.379778091031440685006200821918878702861e+154L, 3.257214233483129514781233066898042490248e+153L); - TEST_c_c (csqrt, 0x1p-1074L, 0x1p-1074L, 2.442109726130830256743814843868934877597e-162L, 1.011554969366634726113090867589031782487e-162L); + /* Bug 14157: spurious exception may occur. */ + TEST_c_c (csqrt, 0x1p-1074L, 0x1p-1074L, 2.442109726130830256743814843868934877597e-162L, 1.011554969366634726113090867589031782487e-162L, UNDERFLOW_EXCEPTION_OK); TEST_c_c (csqrt, 0x1p-1073L, 0x1p-1073L, 3.453664695497464982856905711457966660085e-162L, 1.430554756764195530630723976279903095110e-162L); #endif @@ -3245,17 +3278,17 @@ ctan_test (void) TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L); TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L); - TEST_c_c (ctan, 1, 45, 1.490158918874345552942703234806348520895e-39L, 1.000000000000000000000000000000000000001L); - TEST_c_c (ctan, 1, 47, 2.729321264492904590777293425576722354636e-41L, 1.0); + TEST_c_c (ctan, 1, 45, 1.490158918874345552942703234806348520895e-39L, 1.000000000000000000000000000000000000001L, UNDERFLOW_EXCEPTION_FLOAT); + TEST_c_c (ctan, 1, 47, 2.729321264492904590777293425576722354636e-41L, 1.0, UNDERFLOW_EXCEPTION_FLOAT); #ifndef TEST_FLOAT - TEST_c_c (ctan, 1, 355, 8.140551093483276762350406321792653551513e-309L, 1.0); - TEST_c_c (ctan, 1, 365, 1.677892637497921890115075995898773550884e-317L, 1.0); + TEST_c_c (ctan, 1, 355, 8.140551093483276762350406321792653551513e-309L, 1.0, UNDERFLOW_EXCEPTION_DOUBLE); + TEST_c_c (ctan, 1, 365, 1.677892637497921890115075995898773550884e-317L, 1.0, UNDERFLOW_EXCEPTION_DOUBLE); #endif #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 - TEST_c_c (ctan, 1, 5680, 4.725214596136812019616700920476949798307e-4934L, 1.0); - TEST_c_c (ctan, 1, 5690, 9.739393181626937151720816611272607059057e-4943L, 1.0); + TEST_c_c (ctan, 1, 5680, 4.725214596136812019616700920476949798307e-4934L, 1.0, UNDERFLOW_EXCEPTION); + TEST_c_c (ctan, 1, 5690, 9.739393181626937151720816611272607059057e-4943L, 1.0, UNDERFLOW_EXCEPTION); #endif TEST_c_c (ctan, 0x3.243f6cp-1, 0, -2.287733242885645987394874673945769518150e7L, 0.0); @@ -3270,10 +3303,10 @@ ctan_test (void) TEST_c_c (ctan, 0x1p16383L, 1, 0.1608598776370396607204448234354670036772L, 0.8133818522051542536316746743877629761488L); #endif - TEST_c_c (ctan, 50000, 50000, plus_zero, 1.0); - TEST_c_c (ctan, 50000, -50000, plus_zero, -1.0); - TEST_c_c (ctan, -50000, 50000, minus_zero, 1.0); - TEST_c_c (ctan, -50000, -50000, minus_zero, -1.0); + TEST_c_c (ctan, 50000, 50000, plus_zero, 1.0, UNDERFLOW_EXCEPTION); + TEST_c_c (ctan, 50000, -50000, plus_zero, -1.0, UNDERFLOW_EXCEPTION); + TEST_c_c (ctan, -50000, 50000, minus_zero, 1.0, UNDERFLOW_EXCEPTION); + TEST_c_c (ctan, -50000, -50000, minus_zero, -1.0, UNDERFLOW_EXCEPTION); END (ctan, complex); } @@ -3334,17 +3367,17 @@ ctanh_test (void) TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L); TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L); - TEST_c_c (ctanh, 45, 1, 1.000000000000000000000000000000000000001L, 1.490158918874345552942703234806348520895e-39L); - TEST_c_c (ctanh, 47, 1, 1.0, 2.729321264492904590777293425576722354636e-41L); + TEST_c_c (ctanh, 45, 1, 1.000000000000000000000000000000000000001L, 1.490158918874345552942703234806348520895e-39L, UNDERFLOW_EXCEPTION_FLOAT); + TEST_c_c (ctanh, 47, 1, 1.0, 2.729321264492904590777293425576722354636e-41L, UNDERFLOW_EXCEPTION_FLOAT); #ifndef TEST_FLOAT - TEST_c_c (ctanh, 355, 1, 1.0, 8.140551093483276762350406321792653551513e-309L); - TEST_c_c (ctanh, 365, 1, 1.0, 1.677892637497921890115075995898773550884e-317L); + TEST_c_c (ctanh, 355, 1, 1.0, 8.140551093483276762350406321792653551513e-309L, UNDERFLOW_EXCEPTION_DOUBLE); + TEST_c_c (ctanh, 365, 1, 1.0, 1.677892637497921890115075995898773550884e-317L, UNDERFLOW_EXCEPTION_DOUBLE); #endif #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 - TEST_c_c (ctanh, 5680, 1, 1.0, 4.725214596136812019616700920476949798307e-4934L); - TEST_c_c (ctanh, 5690, 1, 1.0, 9.739393181626937151720816611272607059057e-4943L); + TEST_c_c (ctanh, 5680, 1, 1.0, 4.725214596136812019616700920476949798307e-4934L, UNDERFLOW_EXCEPTION); + TEST_c_c (ctanh, 5690, 1, 1.0, 9.739393181626937151720816611272607059057e-4943L, UNDERFLOW_EXCEPTION); #endif TEST_c_c (ctanh, 0, 0x3.243f6cp-1, 0.0, -2.287733242885645987394874673945769518150e7L); @@ -3359,10 +3392,10 @@ ctanh_test (void) TEST_c_c (ctanh, 1, 0x1p16383L, 0.8133818522051542536316746743877629761488L, 0.1608598776370396607204448234354670036772L); #endif - TEST_c_c (ctanh, 50000, 50000, 1.0, plus_zero); - TEST_c_c (ctanh, 50000, -50000, 1.0, minus_zero); - TEST_c_c (ctanh, -50000, 50000, -1.0, plus_zero); - TEST_c_c (ctanh, -50000, -50000, -1.0, minus_zero); + TEST_c_c (ctanh, 50000, 50000, 1.0, plus_zero, UNDERFLOW_EXCEPTION); + TEST_c_c (ctanh, 50000, -50000, 1.0, minus_zero, UNDERFLOW_EXCEPTION); + TEST_c_c (ctanh, -50000, 50000, -1.0, plus_zero, UNDERFLOW_EXCEPTION); + TEST_c_c (ctanh, -50000, -50000, -1.0, minus_zero, UNDERFLOW_EXCEPTION); END (ctanh, complex); } @@ -3471,7 +3504,7 @@ exp_test (void) #endif TEST_f_f (exp, 1e5, plus_infty, OVERFLOW_EXCEPTION); TEST_f_f (exp, max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (exp, -max_value, 0); + TEST_f_f (exp, -max_value, 0, UNDERFLOW_EXCEPTION); END (exp); } @@ -3608,16 +3641,16 @@ exp10_test (void) TEST_f_f (exp10, -36, 1.0e-36L); #ifndef TEST_FLOAT TEST_f_f (exp10, 305, 1.0e305L); - TEST_f_f (exp10, -305, 1.0e-305L); + TEST_f_f (exp10, -305, 1.0e-305L, UNDERFLOW_EXCEPTION_LDOUBLE_IBM); #endif #if defined TEST_LDOUBLE && LDBL_MAX_10_EXP >= 4932 TEST_f_f (exp10, 4932, 1.0e4932L); - TEST_f_f (exp10, -4932, 1.0e-4932L); + TEST_f_f (exp10, -4932, 1.0e-4932L, UNDERFLOW_EXCEPTION); #endif TEST_f_f (exp10, 1e6, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (exp10, -1e6, 0); + TEST_f_f (exp10, -1e6, 0, UNDERFLOW_EXCEPTION); TEST_f_f (exp10, max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (exp10, -max_value, 0); + TEST_f_f (exp10, -max_value, 0, UNDERFLOW_EXCEPTION); TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L); END (exp10); @@ -3644,9 +3677,9 @@ exp2_test (void) TEST_f_f (exp2, 10, 1024); TEST_f_f (exp2, -1, 0.5); TEST_f_f (exp2, 1e6, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (exp2, -1e6, 0); + TEST_f_f (exp2, -1e6, 0, UNDERFLOW_EXCEPTION); TEST_f_f (exp2, max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (exp2, -max_value, 0); + TEST_f_f (exp2, -max_value, 0, UNDERFLOW_EXCEPTION); TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L); TEST_f_f (exp2, 100.5, 1.792728671193156477399422023278661496394e+30L); @@ -3706,7 +3739,8 @@ expm1_test (void) TEST_f_f (expm1, 100000.0, plus_infty, OVERFLOW_EXCEPTION); check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0); TEST_f_f (expm1, max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_f_f (expm1, -max_value, -1); + /* Bug 6778: spurious underflow exception. */ + TEST_f_f (expm1, -max_value, -1, UNDERFLOW_EXCEPTION_OK); END (expm1); } @@ -3928,16 +3962,16 @@ fma_test (void) TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 0x1.001p+0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1011); TEST_fff_f (fma, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+0, 0x1.fffffffffffffp+1023, -0x1.ffffffffffffdp+1023); TEST_fff_f (fma, 0x1.fffffffffffffp+1023, 2.0, -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023); - TEST_fff_f (fma, 0x1.6a09e667f3bccp-538, 0x1.6a09e667f3bccp-538, 0.0, 0.0); - TEST_fff_f (fma, 0x1.deadbeef2feedp-495, 0x1.deadbeef2feedp-495, -0x1.bf86a5786a574p-989, 0x0.0000042625a1fp-1022); - TEST_fff_f (fma, 0x1.deadbeef2feedp-503, 0x1.deadbeef2feedp-503, -0x1.bf86a5786a574p-1005, 0x0.0000000004262p-1022); - TEST_fff_f (fma, 0x1p-537, 0x1p-538, 0x1p-1074, 0x0.0000000000002p-1022); - TEST_fff_f (fma, 0x1.7fffff8p-968, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000001p-1022); - TEST_fff_f (fma, 0x1.4000004p-967, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000003p-1022); - TEST_fff_f (fma, 0x1.4p-967, -0x1p-106, -0x0.000001p-1022, -0x0.0000010000002p-1022); - TEST_fff_f (fma, -0x1.19cab66d73e17p-959, 0x1.c7108a8c5ff51p-107, -0x0.80b0ad65d9b64p-1022, -0x0.80b0ad65d9d59p-1022); - TEST_fff_f (fma, -0x1.d2eaed6e8e9d3p-979, -0x1.4e066c62ac9ddp-63, -0x0.9245e6b003454p-1022, -0x0.9245c09c5fb5dp-1022); - TEST_fff_f (fma, 0x1.153d650bb9f06p-907, 0x1.2d01230d48407p-125, -0x0.b278d5acfc3cp-1022, -0x0.b22757123bbe9p-1022); + TEST_fff_f (fma, 0x1.6a09e667f3bccp-538, 0x1.6a09e667f3bccp-538, 0.0, 0.0, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.deadbeef2feedp-495, 0x1.deadbeef2feedp-495, -0x1.bf86a5786a574p-989, 0x0.0000042625a1fp-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.deadbeef2feedp-503, 0x1.deadbeef2feedp-503, -0x1.bf86a5786a574p-1005, 0x0.0000000004262p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1p-537, 0x1p-538, 0x1p-1074, 0x0.0000000000002p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.7fffff8p-968, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000001p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.4000004p-967, 0x1p-106, 0x0.000001p-1022, 0x0.0000010000003p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.4p-967, -0x1p-106, -0x0.000001p-1022, -0x0.0000010000002p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, -0x1.19cab66d73e17p-959, 0x1.c7108a8c5ff51p-107, -0x0.80b0ad65d9b64p-1022, -0x0.80b0ad65d9d59p-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, -0x1.d2eaed6e8e9d3p-979, -0x1.4e066c62ac9ddp-63, -0x0.9245e6b003454p-1022, -0x0.9245c09c5fb5dp-1022, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, 0x1.153d650bb9f06p-907, 0x1.2d01230d48407p-125, -0x0.b278d5acfc3cp-1022, -0x0.b22757123bbe9p-1022, UNDERFLOW_EXCEPTION); TEST_fff_f (fma, -0x1.fffffffffffffp-711, 0x1.fffffffffffffp-275, 0x1.fffffe00007ffp-983, 0x1.7ffffe00007ffp-983); #endif #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 64 @@ -3946,12 +3980,13 @@ fma_test (void) TEST_fff_f (fma, 0xc.7fc000003ffffffp-1194L, 0x8.1e0003fffffffffp+15327L, -0x8.fffep+14072L, 0xc.ae9f164020effffp+14136L); TEST_fff_f (fma, -0x8.0001fc000000003p+1798L, 0xcp-2230L, 0x8.f7e000000000007p-468L, -0xc.0002f9ffee10404p-429L); TEST_fff_f (fma, 0xc.0000000000007ffp+10130L, -0x8.000000000000001p+4430L, 0xc.07000000001ffffp+14513L, -0xb.fffffffffffd7e4p+14563L); - TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L); + /* Bug 14152: underflow exception may be missing. */ + TEST_fff_f (fma, 0xb.ffffp-4777L, 0x8.000000fffffffffp-11612L, -0x0.3800fff8p-16385L, 0x5.c7fe80c7ffeffffp-16385L, UNDERFLOW_EXCEPTION_OK); #endif #if defined (TEST_LDOUBLE) && LDBL_MANT_DIG == 113 TEST_fff_f (fma, 0x1.bb2de33e02ccbbfa6e245a7c1f71p-2584L, -0x1.6b500daf0580d987f1bc0cadfcddp-13777L, 0x1.613cd91d9fed34b33820e5ab9d8dp-16378L, -0x1.3a79fb50eb9ce887cffa0f09bd9fp-16360L); - TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L); - TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L); + TEST_fff_f (fma, -0x1.f949b880cacb0f0c61540105321dp-5954L, -0x1.3876cec84b4140f3bd6198731b7ep-10525L, -0x0.a5dc1c6cfbc498c54fb0b504bf19p-16382L, -0x0.a5dc1c6cfbc498c54fb0b5038abbp-16382L, UNDERFLOW_EXCEPTION); + TEST_fff_f (fma, -0x1.0000fffffffffp-16221L, 0x1.0000001fffff8007fep-239L, 0x0.ff87ffffffffffffe000003fffffp-16382L, 0x0.ff87ffffffffffffdffc003bff7fp-16382L, UNDERFLOW_EXCEPTION); TEST_fff_f (fma, -0x1.ac79c9376ef447f3827c9e9de008p-2228L, -0x1.5ba830022b6139e21fbe7270cad8p-6314L, 0x1.e8282b6a26bb6a9daf5c8e73e9f9p-8616L, 0x1.22f14a0253878a730cd1aee373adp-8541L); TEST_fff_f (fma, -0x1.c69749ec574caaa2ab8e97ddb9f3p+2652L, 0x1.f34235ff9d095449c29b4831b62dp+3311L, 0x1.fbe4302df23354dbd0c4d3cfe606p+5879L, -0x1.bb473bfdfb7a6e18886ce6e57eafp+5964L); TEST_fff_f (fma, -0x1.ca8835fc6ecfb5398625fc891be5p-1686L, 0x1.621e1972bbe2180e5be9dd7d8df5p-7671L, -0x1.7d2d21b73b52cf20dec2a83902a4p-9395L, -0x1.3d2322191c9c88bc68a62ab8042cp-9356L); @@ -4304,7 +4339,8 @@ j0_test (void) TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L); TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L); - TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L); + /* Bug 14155: spurious exception may occur. */ + TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L, UNDERFLOW_EXCEPTION_OK); #ifndef TEST_FLOAT TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L); @@ -4433,7 +4469,8 @@ jn_test (void) TEST_ff_f (jn, 8, 2.4048255576957729L, 0.92165786705344923232879022467054148E-4L); TEST_ff_f (jn, 9, 2.4048255576957729L, 0.12517270977961513005428966643852564E-4L); - TEST_ff_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L); + /* Bug 14155: spurious exception may occur. */ + TEST_ff_f (jn, 2, 0x1.ffff62p+99L, -4.43860668048170034334926693188979974489e-16L, UNDERFLOW_EXCEPTION_OK); END (jn); } @@ -5924,7 +5961,7 @@ nexttoward_test (void) TEST_ff_f (nexttoward, -1.0, -0.9L, -0x0.ffffffp0); TEST_ff_f (nexttoward, -1.0, LDBL_MAX, -0x0.ffffffp0); TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.ffffffp0); - TEST_ff_f (nexttoward, -0x1.3p-145, -0xap-148L, -0x1.4p-145); + TEST_ff_f (nexttoward, -0x1.3p-145, -0xap-148L, -0x1.4p-145, UNDERFLOW_EXCEPTION); # if LDBL_MANT_DIG >= 64 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.000002p0); TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.ffffffp0); @@ -5958,7 +5995,7 @@ nexttoward_test (void) TEST_ff_f (nexttoward, -1.0, LDBL_MAX, -0x0.fffffffffffff8p0); TEST_ff_f (nexttoward, -1.0, -0x0.fffffffffffff8p0, -0x0.fffffffffffff8p0); TEST_ff_f (nexttoward, -1.0, -0x8.00346dc5d6388p-3L, -0x1.0000000000001p0); - TEST_ff_f (nexttoward, 0x1p-1074, 0x1p-1073L, 0x1p-1073); + TEST_ff_f (nexttoward, 0x1p-1074, 0x1p-1073L, 0x1p-1073, UNDERFLOW_EXCEPTION); # if LDBL_MANT_DIG >= 64 TEST_ff_f (nexttoward, 1.0, 0x1.000000000000002p0L, 0x1.0000000000001p0); TEST_ff_f (nexttoward, 1.0, 0x0.ffffffffffffffffp0L, 0x0.fffffffffffff8p0); @@ -6225,9 +6262,9 @@ pow_test (void) check_int ("errno for pow(-0,-num) == ERANGE", errno, ERANGE, 0, 0, 0); TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, 10, -0x1p72L, 0); + TEST_ff_f (pow, 10, -0x1p72L, 0, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, max_value, max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, 10, -max_value, 0); + TEST_ff_f (pow, 10, -max_value, 0, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, 0, 1, 0); TEST_ff_f (pow, 0, 11, 0); @@ -6417,7 +6454,7 @@ pow_test (void) TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L); #if defined TEST_DOUBLE || defined TEST_LDOUBLE - TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0); + TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0, UNDERFLOW_EXCEPTION); #endif TEST_ff_f (pow, -1.0, -0xffffff, -1.0); @@ -6466,30 +6503,31 @@ pow_test (void) TEST_ff_f (pow, -2.0, 126, 0x1p126); TEST_ff_f (pow, -2.0, 127, -0x1p127); - TEST_ff_f (pow, -2.0, -126, 0x1p-126); - TEST_ff_f (pow, -2.0, -127, -0x1p-127); + /* Allow inexact results for float to be considered to underflow. */ + TEST_ff_f (pow, -2.0, -126, 0x1p-126, UNDERFLOW_EXCEPTION_OK_FLOAT); + TEST_ff_f (pow, -2.0, -127, -0x1p-127, UNDERFLOW_EXCEPTION_OK_FLOAT); - TEST_ff_f (pow, -2.0, -0xffffff, minus_zero); - TEST_ff_f (pow, -2.0, -0x1fffffe, plus_zero); + TEST_ff_f (pow, -2.0, -0xffffff, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, -0x1fffffe, plus_zero, UNDERFLOW_EXCEPTION); #ifndef TEST_FLOAT - TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+52L, minus_zero); - TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+53L, plus_zero); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+52L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffp+53L, plus_zero, UNDERFLOW_EXCEPTION); #endif #ifdef TEST_LDOUBLE # if LDBL_MANT_DIG >= 64 - TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+63L, minus_zero); - TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+64L, plus_zero); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+63L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, -0x1.fffffffffffffffep+64L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 106 - TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); - TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 113 - TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); - TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -2.0, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero, UNDERFLOW_EXCEPTION); # endif #endif - TEST_ff_f (pow, -2.0, -max_value, plus_zero); + TEST_ff_f (pow, -2.0, -max_value, plus_zero, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, -2.0, 0xffffff, minus_infty, OVERFLOW_EXCEPTION); TEST_ff_f (pow, -2.0, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); @@ -6516,32 +6554,32 @@ pow_test (void) TEST_ff_f (pow, -max_value, 0.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -max_value, 1.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -max_value, 1000.5, nan_value, INVALID_EXCEPTION); - TEST_ff_f (pow, -max_value, -2, plus_zero); - TEST_ff_f (pow, -max_value, -3, minus_zero); + TEST_ff_f (pow, -max_value, -2, plus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -3, minus_zero, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, -max_value, 2, plus_infty, OVERFLOW_EXCEPTION); TEST_ff_f (pow, -max_value, 3, minus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, -max_value, -0xffffff, minus_zero); - TEST_ff_f (pow, -max_value, -0x1fffffe, plus_zero); + TEST_ff_f (pow, -max_value, -0xffffff, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -0x1fffffe, plus_zero, UNDERFLOW_EXCEPTION); #ifndef TEST_FLOAT - TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+52L, minus_zero); - TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+53L, plus_zero); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+52L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffp+53L, plus_zero, UNDERFLOW_EXCEPTION); #endif #ifdef TEST_LDOUBLE # if LDBL_MANT_DIG >= 64 - TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+63L, minus_zero); - TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+64L, plus_zero); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+63L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -0x1.fffffffffffffffep+64L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 106 - TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); - TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+105L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffff8p+106L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 113 - TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); - TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+112L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -max_value, -0x1.ffffffffffffffffffffffffffffp+113L, plus_zero, UNDERFLOW_EXCEPTION); # endif #endif - TEST_ff_f (pow, -max_value, -max_value, plus_zero); + TEST_ff_f (pow, -max_value, -max_value, plus_zero, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, -max_value, 0xffffff, minus_infty, OVERFLOW_EXCEPTION); TEST_ff_f (pow, -max_value, 0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); @@ -6592,36 +6630,37 @@ pow_test (void) #endif TEST_ff_f (pow, -0.5, -max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, -0.5, 0xffffff, minus_zero); - TEST_ff_f (pow, -0.5, 0x1fffffe, plus_zero); + TEST_ff_f (pow, -0.5, 0xffffff, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, 0x1fffffe, plus_zero, UNDERFLOW_EXCEPTION); #ifndef TEST_FLOAT - TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+52L, minus_zero); - TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+53L, plus_zero); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+52L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffp+53L, plus_zero, UNDERFLOW_EXCEPTION); #endif #ifdef TEST_LDOUBLE # if LDBL_MANT_DIG >= 64 - TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+63L, minus_zero); - TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+64L, plus_zero); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+63L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, 0x1.fffffffffffffffep+64L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 106 - TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); - TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 113 - TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); - TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -0.5, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero, UNDERFLOW_EXCEPTION); # endif #endif - TEST_ff_f (pow, -0.5, max_value, plus_zero); + TEST_ff_f (pow, -0.5, max_value, plus_zero, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, -min_value, 0.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -min_value, 1.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -min_value, 1000.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (pow, -min_value, -2, plus_infty, OVERFLOW_EXCEPTION); TEST_ff_f (pow, -min_value, -3, minus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, -min_value, 1, -min_value); - TEST_ff_f (pow, -min_value, 2, plus_zero); - TEST_ff_f (pow, -min_value, 3, minus_zero); + /* Allow inexact results to be considered to underflow. */ + TEST_ff_f (pow, -min_value, 1, -min_value, UNDERFLOW_EXCEPTION_OK); + TEST_ff_f (pow, -min_value, 2, plus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 3, minus_zero, UNDERFLOW_EXCEPTION); TEST_ff_f (pow, -min_value, -0xffffff, minus_infty, OVERFLOW_EXCEPTION); TEST_ff_f (pow, -min_value, -0x1fffffe, plus_infty, OVERFLOW_EXCEPTION); @@ -6645,27 +6684,27 @@ pow_test (void) #endif TEST_ff_f (pow, -min_value, -max_value, plus_infty, OVERFLOW_EXCEPTION); - TEST_ff_f (pow, -min_value, 0xffffff, minus_zero); - TEST_ff_f (pow, -min_value, 0x1fffffe, plus_zero); + TEST_ff_f (pow, -min_value, 0xffffff, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 0x1fffffe, plus_zero, UNDERFLOW_EXCEPTION); #ifndef TEST_FLOAT - TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+52L, minus_zero); - TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+53L, plus_zero); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+52L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffp+53L, plus_zero, UNDERFLOW_EXCEPTION); #endif #ifdef TEST_LDOUBLE # if LDBL_MANT_DIG >= 64 - TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+63L, minus_zero); - TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+64L, plus_zero); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+63L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 0x1.fffffffffffffffep+64L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 106 - TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero); - TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+105L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffff8p+106L, plus_zero, UNDERFLOW_EXCEPTION); # endif # if LDBL_MANT_DIG >= 113 - TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero); - TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+112L, minus_zero, UNDERFLOW_EXCEPTION); + TEST_ff_f (pow, -min_value, 0x1.ffffffffffffffffffffffffffffp+113L, plus_zero, UNDERFLOW_EXCEPTION); # endif #endif - TEST_ff_f (pow, -min_value, max_value, plus_zero); + TEST_ff_f (pow, -min_value, max_value, plus_zero, UNDERFLOW_EXCEPTION); #ifndef TEST_LDOUBLE /* Bug 13881. */ TEST_ff_f (pow, 0x0.ffffffp0, 10, 0.999999403953712118183885036774764444747L); @@ -7518,13 +7557,13 @@ scalbn_test (void) TEST_fi_f (scalbn, 1, 0L, 1); TEST_fi_f (scalbn, 1, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbn, 1, INT_MIN, plus_zero); + TEST_fi_f (scalbn, 1, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbn, max_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbn, max_value, INT_MIN, plus_zero); + TEST_fi_f (scalbn, max_value, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbn, min_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbn, min_value, INT_MIN, plus_zero); + TEST_fi_f (scalbn, min_value, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbn, min_value / 4, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbn, min_value / 4, INT_MIN, plus_zero); + TEST_fi_f (scalbn, min_value / 4, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); END (scalbn); } @@ -7549,32 +7588,32 @@ scalbln_test (void) TEST_fl_f (scalbln, 1, 0L, 1); TEST_fi_f (scalbln, 1, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, 1, INT_MIN, plus_zero); + TEST_fi_f (scalbln, 1, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, max_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, max_value, INT_MIN, plus_zero); + TEST_fi_f (scalbln, max_value, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value, INT_MIN, plus_zero); + TEST_fi_f (scalbln, min_value, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value / 4, INT_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value / 4, INT_MIN, plus_zero); + TEST_fi_f (scalbln, min_value / 4, INT_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, 1, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, 1, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, 1, LONG_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, max_value, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, max_value, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, max_value, LONG_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, min_value, LONG_MIN, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value / 4, LONG_MAX, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value / 4, LONG_MIN, plus_zero); + TEST_fi_f (scalbln, min_value / 4, LONG_MIN, plus_zero, UNDERFLOW_EXCEPTION); #if LONG_MAX >= 0x100000000 TEST_fi_f (scalbln, 1, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, 1, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, 1, -0x88000000L, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, max_value, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, max_value, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, max_value, -0x88000000L, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, min_value, -0x88000000L, plus_zero, UNDERFLOW_EXCEPTION); TEST_fi_f (scalbln, min_value / 4, 0x88000000L, plus_infty, OVERFLOW_EXCEPTION); - TEST_fi_f (scalbln, min_value / 4, -0x88000000L, plus_zero); + TEST_fi_f (scalbln, min_value / 4, -0x88000000L, plus_zero, UNDERFLOW_EXCEPTION); #endif END (scalbn); @@ -8025,7 +8064,8 @@ tan_test (void) TEST_f_f (tan, nan_value, nan_value); check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0); - TEST_f_f (tan, M_PI_4l, 1); + /* Bug 14154: spurious exception may occur. */ + TEST_f_f (tan, M_PI_4l, 1, UNDERFLOW_EXCEPTION_OK_FLOAT); TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L); TEST_f_f (tan, 0x1p65, -0.0472364872359047946798414219288370688827L); @@ -8428,7 +8468,8 @@ y1_test (void) TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L); TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L); - TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L); + /* Bug 14155: spurious exception may occur. */ + TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L, UNDERFLOW_EXCEPTION_OK); #ifndef TEST_FLOAT TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L); diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index b4ca2127d7..d66eb1269b 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -728,12 +728,12 @@ float: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i plus underflow exception for float": double: 1 idouble: 1 ildouble: 1 ldouble: 1 -Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i plus underflow exception for float": double: 1 idouble: 1 Test "Imaginary part of: cexp (0 + 0x1p65 i) == 0.99888622066058013610642172179340364209972 - 0.047183876212354673805106149805700013943218 i": @@ -1383,7 +1383,7 @@ ldouble: 1 Test "Imaginary part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i": ildouble: 1 ldouble: 1 -Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i": +Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i plus underflow exception allowed": ildouble: 1 ldouble: 1 Test "Imaginary part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i": @@ -1428,10 +1428,10 @@ ifloat: 1 Test "Real part of: ctan (0x3.243f6cp-1 + 0 i) == -2.287733242885645987394874673945769518150e7 + 0.0 i": float: 1 ifloat: 1 -Test "Real part of: ctan (1 + 45 i) == 1.490158918874345552942703234806348520895e-39 + 1.000000000000000000000000000000000000001 i": +Test "Real part of: ctan (1 + 45 i) == 1.490158918874345552942703234806348520895e-39 + 1.000000000000000000000000000000000000001 i plus underflow exception for float": ildouble: 1 ldouble: 1 -Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636e-41 + 1.0 i": +Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636e-41 + 1.0 i plus underflow exception for float": double: 1 idouble: 1 ildouble: 2 @@ -1479,10 +1479,10 @@ ldouble: 1 Test "Imaginary part of: ctanh (1 + 0x1p127 i) == 0.9101334047676183761532873794426475906201 + 0.2446359391192790896381501310437708987204 i": float: 1 ifloat: 1 -Test "Imaginary part of: ctanh (45 + 1 i) == 1.000000000000000000000000000000000000001 + 1.490158918874345552942703234806348520895e-39 i": +Test "Imaginary part of: ctanh (45 + 1 i) == 1.000000000000000000000000000000000000001 + 1.490158918874345552942703234806348520895e-39 i plus underflow exception for float": ildouble: 1 ldouble: 1 -Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425576722354636e-41 i": +Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425576722354636e-41 i plus underflow exception for float": double: 1 idouble: 1 ildouble: 2 @@ -1627,7 +1627,7 @@ idouble: 1 ifloat: 2 ildouble: 2 ldouble: 2 -Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17": +Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17 plus underflow exception allowed": float: 1 ifloat: 1 Test "j0 (10.0) == -0.245935764451348335197760862485328754": @@ -1765,7 +1765,7 @@ double: 2 idouble: 2 ildouble: 1 ldouble: 1 -Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16": +Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16 plus underflow exception allowed": float: 1 ifloat: 1 ildouble: 1 @@ -2158,7 +2158,7 @@ ldouble: 1 Test "tan (1e22) == -1.628778225606898878549375936939548513545": ildouble: 1 ldouble: 1 -Test "tan (pi/4) == 1": +Test "tan (pi/4) == 1 plus underflow exception allowed for float": double: 1 float: 1 idouble: 1 @@ -2400,7 +2400,7 @@ ldouble: 1 Test "y1 (0x1.001000001p+593) == 3.927269966354206207832593635798954916263e-90": ildouble: 2 ldouble: 2 -Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16": +Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16 plus underflow exception allowed": double: 1 float: 2 idouble: 1 diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index d3770c8d1d..d90d1ccf29 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -678,10 +678,10 @@ ldouble: 1 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": float: 1 ifloat: 1 -Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i plus underflow exception for float": ildouble: 1 ldouble: 1 -Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i": +Test "Imaginary part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i plus underflow exception for float": double: 1 idouble: 1 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": @@ -834,7 +834,7 @@ double: 1 float: 1 idouble: 1 ifloat: 1 -Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i) == 38.53183941910362389414093724045094697423 + 1.276276851248440096917018665609900318458e-39 i": +Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i) == 38.53183941910362389414093724045094697423 + 1.276276851248440096917018665609900318458e-39 i plus underflow exception for float": float: 1 ifloat: 1 Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i) == 308.4052305577487344482591243175787477115 + pi/4*log10(e) i": @@ -1248,7 +1248,7 @@ ldouble: 1 Test "Imaginary part of: csqrt (0x1p-1073 + 0x1p-1073 i) == 3.453664695497464982856905711457966660085e-162 + 1.430554756764195530630723976279903095110e-162 i": ildouble: 1 ldouble: 1 -Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i": +Test "Imaginary part of: csqrt (0x1p-1074 + 0x1p-1074 i) == 2.442109726130830256743814843868934877597e-162 + 1.011554969366634726113090867589031782487e-162 i plus underflow exception allowed": ildouble: 1 ldouble: 1 Test "Imaginary part of: csqrt (0x1p-147 + 0x1p-147 i) == 8.225610928685557596194006925540350401606e-23 + 3.407159605465907500737319471202779419102e-23 i": @@ -1297,10 +1297,10 @@ idouble: 1 Test "Real part of: ctan (0x3.243f6cp-1 + 0 i) == -2.287733242885645987394874673945769518150e7 + 0.0 i": float: 1 ifloat: 1 -Test "Real part of: ctan (1 + 45 i) == 1.490158918874345552942703234806348520895e-39 + 1.000000000000000000000000000000000000001 i": +Test "Real part of: ctan (1 + 45 i) == 1.490158918874345552942703234806348520895e-39 + 1.000000000000000000000000000000000000001 i plus underflow exception for float": ildouble: 1 ldouble: 1 -Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636e-41 + 1.0 i": +Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636e-41 + 1.0 i plus underflow exception for float": ildouble: 2 ldouble: 2 @@ -1352,10 +1352,10 @@ ldouble: 1 Test "Real part of: ctanh (1 + 0x1p127 i) == 0.9101334047676183761532873794426475906201 + 0.2446359391192790896381501310437708987204 i": double: 1 idouble: 1 -Test "Imaginary part of: ctanh (45 + 1 i) == 1.000000000000000000000000000000000000001 + 1.490158918874345552942703234806348520895e-39 i": +Test "Imaginary part of: ctanh (45 + 1 i) == 1.000000000000000000000000000000000000001 + 1.490158918874345552942703234806348520895e-39 i plus underflow exception for float": ildouble: 1 ldouble: 1 -Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425576722354636e-41 i": +Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425576722354636e-41 i plus underflow exception for float": ildouble: 2 ldouble: 2 @@ -1395,7 +1395,7 @@ idouble: 2 ifloat: 1 ildouble: 1 ldouble: 1 -Test "exp10 (-305) == 1.0e-305": +Test "exp10 (-305) == 1.0e-305 plus underflow exception for IBM long double": double: 1 idouble: 1 Test "exp10 (-36) == 1.0e-36": @@ -1515,7 +1515,7 @@ ldouble: 2 Test "j0 (0.75) == 0.864242275166648623555731103820923211": float: 1 ifloat: 1 -Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17": +Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17 plus underflow exception allowed": float: 2 ifloat: 2 Test "j0 (10.0) == -0.245935764451348335197760862485328754": @@ -1638,7 +1638,7 @@ idouble: 1 ifloat: 4 ildouble: 1 ldouble: 1 -Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16": +Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16 plus underflow exception allowed": double: 2 float: 2 idouble: 2 @@ -2187,7 +2187,7 @@ ldouble: 1 Test "y1 (0x1.001000001p+593) == 3.927269966354206207832593635798954916263e-90": ildouble: 2 ldouble: 2 -Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16": +Test "y1 (0x1.27e204p+99) == -8.881610148467797208469612080785210013461e-16 plus underflow exception allowed": double: 1 idouble: 1 ildouble: 1