mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
[CRT]
Fix _fpclass. Spotted by: Vincenzo Cotugno Reviewed by: Timo Kreuzer svn path=/trunk/; revision=54414
This commit is contained in:
parent
99f8b1fe06
commit
1f282745da
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue