* math/test-misc.c (main): Add a few more over and underflow tests
	for scalb.
This commit is contained in:
Ulrich Drepper 2000-12-05 06:49:26 +00:00
parent 6d0c49145e
commit b210e4ccb6
2 changed files with 46 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2000-12-04 Ulrich Drepper <drepper@redhat.com> 2000-12-04 Ulrich Drepper <drepper@redhat.com>
* math/test-misc.c (main): Add a few more over and underflow tests
for scalb.
* sysdeps/i386/fpu/e_scalb.S: Handle NaN as first parameter correctly. * sysdeps/i386/fpu/e_scalb.S: Handle NaN as first parameter correctly.
* sysdeps/i386/fpu/e_scalbf.S: Likewise. * sysdeps/i386/fpu/e_scalbf.S: Likewise.
* sysdeps/i386/fpu/e_scalbl.S: Likewise. * sysdeps/i386/fpu/e_scalbl.S: Likewise.

View File

@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <fenv.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -208,5 +209,47 @@ main (void)
} }
#endif #endif
#ifndef NO_LONG_DOUBLE
{
long double r;
feclearexcept (FE_ALL_EXCEPT);
r = scalbl (LDBL_MIN, 2147483647);
if (! isinf (r))
{
puts ("scalbl (LDBL_MIN, 2147483647) does not return Inf");
result = 1;
}
else if (signbit (r) != 0)
{
puts ("scalbl (LDBL_MIN, 2147483647) returns -Inf");
result = 1;
}
else if (fetestexcept (FE_UNDERFLOW))
{
puts ("scalbl(NaN, 0) raises underflow exception");
result = 1;
}
feclearexcept (FE_ALL_EXCEPT);
r = scalbl (LDBL_MAX, -2147483647);
if (r != 0.0)
{
puts ("scalbl (LDBL_MAX, -2147483647) does not return 0");
result = 1;
}
else if (signbit (r) != 0)
{
puts ("scalbl (LDBL_MAX, -2147483647) returns -Inf");
result = 1;
}
else if (fetestexcept (FE_OVERFLOW))
{
puts ("scalbl(NaN, 0) raises overflow exception");
result = 1;
}
}
#endif
return result; return result;
} }