Fix _fpclass.
Spotted by: Vincenzo Cotugno
Reviewed by: Timo Kreuzer

svn path=/trunk/; revision=54414
This commit is contained in:
Pierre Schweitzer 2011-11-17 22:38:15 +00:00
parent 99f8b1fe06
commit 1f282745da
2 changed files with 18 additions and 22 deletions

View file

@ -1,8 +1,8 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crt/??????
* PURPOSE: Unknown
* FILE: lib/sdk/crt/float/fpclass.c
* PURPOSE: Floating-point classes
* PROGRAMER: Unknown
* UPDATE HISTORY:
* 25/11/05: Added license header
@ -55,32 +55,28 @@ fpclass_t _fpclass(double __d)
d.__d = &__d;
if ( d.d->exponent == 0 ) {
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
if ( d.d->sign ==0 )
return FP_NZERO;
else
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
if ( d.d->sign == 0 )
return FP_PZERO;
} else {
if ( d.d->sign ==0 )
return FP_NDENORM;
else
return FP_NZERO;
} else {
if ( d.d->sign == 0 )
return FP_PDENORM;
else
return FP_NDENORM;
}
}
if (d.d->exponent == 0x7ff ) {
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
if ( d.d->sign ==0 )
return FP_NINF;
else
else if (d.d->exponent == 0x7ff ) {
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
if ( d.d->sign == 0 )
return FP_PINF;
else
return FP_NINF;
}
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
else if ( (d.d->mantissah & 0x80000) != 0 ) {
return FP_QNAN;
}
else if ( d.d->mantissah == 0 && d.d->mantissal != 0 ) {
return FP_SNAN;
}
}
return 0;
return FP_SNAN;
}

View file

@ -50,7 +50,7 @@ int _isnanl(long double __x)
exponent and a nonzero mantissa. */
return (( x.x->exponent == 0x7fff)
&& ( (x.x->mantissah & 0x80000000) != 0)
&& ( (x.x->mantissah & 0x80000) != 0)
&& ( (x.x->mantissah & (unsigned int)0x7fffffff) != 0 || x.x->mantissal != 0 ));
}
@ -91,7 +91,7 @@ int _isinfl(long double __x)
maximum possible value and a zero mantissa. */
if ( x.x->exponent == 0x7fff && ( (x.x->mantissah == 0x80000000 ) && x.x->mantissal == 0 ))
if ( x.x->exponent == 0x7fff && ( (x.x->mantissah == 0x80000 ) && x.x->mantissal == 0 ))
return x.x->sign ? -1 : 1;
return 0;
}