* math/test-misc.c: Add more tests for nextafter.
	* sysdeps/i386/fpu/s_nextafterl.c: Handle decrement for x<0 correctly.
	* sysdeps/ieee754/ldbl-96/math_ldbl.h
	(ieee_long_double_shape_type): Make sign_exponent element signed.
This commit is contained in:
Ulrich Drepper 2000-12-19 05:07:31 +00:00
parent aa9e3c3940
commit cc46d0cfcf
4 changed files with 142 additions and 39 deletions

View File

@ -1,5 +1,10 @@
2000-12-18 Ulrich Drepper <drepper@redhat.com> 2000-12-18 Ulrich Drepper <drepper@redhat.com>
* math/test-misc.c: Add more tests for nextafter.
* sysdeps/i386/fpu/s_nextafterl.c: Handle decrement for x<0 correctly.
* sysdeps/ieee754/ldbl-96/math_ldbl.h
(ieee_long_double_shape_type): Make sign_exponent element signed.
* manual/message.texi: Add Estonian to plural overview list. * manual/message.texi: Add Estonian to plural overview list.
Correct rule for Slavic languages. Correct rule for Slavic languages.
Patch by Stanislav Brabec <utx@penguin.cz>. Patch by Stanislav Brabec <utx@penguin.cz>.

View File

@ -114,41 +114,138 @@ main (void)
} }
} }
if (fpclassify (FLT_MIN) != FP_NORMAL) {
{ float f;
printf ("fpclassify (FLT_MIN) failed: %d\n", fpclassify (FLT_MIN));
result = 1; f = FLT_MIN;
} if (fpclassify (f) != FP_NORMAL)
if (fpclassify (nextafterf (FLT_MIN, FLT_MIN / 2.0f)) != FP_SUBNORMAL) {
{ printf ("fpclassify (FLT_MIN) failed: %d\n", fpclassify (f));
printf ("fpclassify (FLT_MIN-epsilon) failed: %d\n", result = 1;
fpclassify (nextafterf (FLT_MIN, FLT_MIN / 2.0f))); }
result = 1; f = nextafterf (f, FLT_MIN / 2.0f);
} if (fpclassify (f) != FP_SUBNORMAL)
if (fpclassify (DBL_MIN) != FP_NORMAL) {
{ printf ("fpclassify (FLT_MIN-epsilon) failed: %d\n", fpclassify (f));
printf ("fpclassify (DBL_MIN) failed: %d\n", fpclassify (DBL_MIN)); result = 1;
result = 1; }
} f = nextafterf (f, FLT_MIN);
if (fpclassify (nextafter (DBL_MIN, DBL_MIN / 2.0)) != FP_SUBNORMAL) if (fpclassify (f) != FP_NORMAL)
{ {
printf ("fpclassify (DBL_MIN-epsilon) failed: %d\n", printf ("fpclassify (FLT_MIN-epsilon+epsilong) failed: %d\n",
fpclassify (nextafter (DBL_MIN, DBL_MIN / 2.0))); fpclassify (f));
result = 1; result = 1;
} }
f = -FLT_MIN;
if (fpclassify (f) != FP_NORMAL)
{
printf ("fpclassify (-FLT_MIN) failed: %d\n", fpclassify (f));
result = 1;
}
f = nextafterf (f, -FLT_MIN / 2.0f);
if (fpclassify (f) != FP_SUBNORMAL)
{
printf ("fpclassify (-FLT_MIN-epsilon) failed: %d\n", fpclassify (f));
result = 1;
}
f = nextafterf (f, -FLT_MIN);
if (fpclassify (f) != FP_NORMAL)
{
printf ("fpclassify (-FLT_MIN-epsilon+epsilong) failed: %d\n",
fpclassify (f));
result = 1;
}
}
{
double d;
d = DBL_MIN;
if (fpclassify (d) != FP_NORMAL)
{
printf ("fpclassify (DBL_MIN) failed: %d\n", fpclassify (d));
result = 1;
}
d = nextafter (d, DBL_MIN / 2.0);
if (fpclassify (d) != FP_SUBNORMAL)
{
printf ("fpclassify (DBL_MIN-epsilon) failed: %d\n", fpclassify (d));
result = 1;
}
d = nextafter (d, DBL_MIN);
if (fpclassify (d) != FP_NORMAL)
{
printf ("fpclassify (DBL_MIN-epsilon+epsilon) failed: %d\n",
fpclassify (d));
result = 1;
}
d = -DBL_MIN;
if (fpclassify (d) != FP_NORMAL)
{
printf ("fpclassify (-DBL_MIN) failed: %d\n", fpclassify (d));
result = 1;
}
d = nextafter (d, -DBL_MIN / 2.0);
if (fpclassify (d) != FP_SUBNORMAL)
{
printf ("fpclassify (-DBL_MIN-epsilon) failed: %d\n", fpclassify (d));
result = 1;
}
d = nextafter (d, -DBL_MIN);
if (fpclassify (d) != FP_NORMAL)
{
printf ("fpclassify (-DBL_MIN-epsilon+epsilon) failed: %d\n",
fpclassify (d));
result = 1;
}
}
#ifndef NO_LONG_DOUBLE #ifndef NO_LONG_DOUBLE
if (fpclassify (LDBL_MIN) != FP_NORMAL) {
{ long double ld;
printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (LDBL_MIN));
result = 1; ld = LDBL_MIN;
} if (fpclassify (ld) != FP_NORMAL)
if (fpclassify (nextafterl (LDBL_MIN, LDBL_MIN / 2.0)) != FP_SUBNORMAL) {
{ printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (ld));
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%Lg)\n", result = 1;
fpclassify (nextafterl (LDBL_MIN, LDBL_MIN / 2.0)), }
nextafterl (LDBL_MIN, LDBL_MIN / 2.0)); ld = nextafterl (ld, LDBL_MIN / 2.0);
result = 1; if (fpclassify (ld) != FP_SUBNORMAL)
} {
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
fpclassify (ld), ld);
result = 1;
}
ld = nextafterl (ld, LDBL_MIN);
if (fpclassify (ld) != FP_NORMAL)
{
printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
fpclassify (ld), ld);
result = 1;
}
ld = -LDBL_MIN;
if (fpclassify (ld) != FP_NORMAL)
{
printf ("fpclassify (-LDBL_MIN) failed: %d\n", fpclassify (ld));
result = 1;
}
ld = nextafterl (ld, -LDBL_MIN / 2.0);
if (fpclassify (ld) != FP_SUBNORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
fpclassify (ld), ld);
result = 1;
}
ld = nextafterl (ld, -LDBL_MIN);
if (fpclassify (ld) != FP_NORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
fpclassify (ld), ld);
result = 1;
}
}
#endif #endif
if (! isnormal (FLT_MIN)) if (! isnormal (FLT_MIN))

View File

@ -36,8 +36,9 @@ static char rcsid[] = "$NetBSD: $";
long double x,y; long double x,y;
#endif #endif
{ {
int32_t hx,hy,ix,iy; u_int32_t hx,hy,ix,iy;
u_int32_t lx,ly,esx,esy; u_int32_t lx,ly;
int32_t esx,esy;
GET_LDOUBLE_WORDS(esx,hx,lx,x); GET_LDOUBLE_WORDS(esx,hx,lx,x);
GET_LDOUBLE_WORDS(esy,hy,ly,y); GET_LDOUBLE_WORDS(esy,hy,ly,y);
@ -90,7 +91,7 @@ static char rcsid[] = "$NetBSD: $";
else { else {
esx -= 1; esx -= 1;
hx = hx - 1; hx = hx - 1;
if (esx > 0) if ((esx&0x7fff) > 0)
hx |= 0x80000000; hx |= 0x80000000;
} }
} else } else

View File

@ -13,7 +13,7 @@ typedef union
struct struct
{ {
unsigned int sign_exponent:16; unsigned int sign_exponent:16;
unsigned int empty:16; int empty:16;
u_int32_t msw; u_int32_t msw;
u_int32_t lsw; u_int32_t lsw;
} parts; } parts;
@ -30,7 +30,7 @@ typedef union
{ {
u_int32_t lsw; u_int32_t lsw;
u_int32_t msw; u_int32_t msw;
unsigned int sign_exponent:16; int sign_exponent:16;
unsigned int empty:16; unsigned int empty:16;
} parts; } parts;
} ieee_long_double_shape_type; } ieee_long_double_shape_type;