mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 02:09:43 +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
2 changed files with 18 additions and 22 deletions
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: lib/crt/??????
|
* FILE: lib/sdk/crt/float/fpclass.c
|
||||||
* PURPOSE: Unknown
|
* PURPOSE: Floating-point classes
|
||||||
* PROGRAMER: Unknown
|
* PROGRAMER: Unknown
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 25/11/05: Added license header
|
* 25/11/05: Added license header
|
||||||
|
@ -55,32 +55,28 @@ fpclass_t _fpclass(double __d)
|
||||||
d.__d = &__d;
|
d.__d = &__d;
|
||||||
|
|
||||||
if ( d.d->exponent == 0 ) {
|
if ( d.d->exponent == 0 ) {
|
||||||
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
|
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
|
||||||
if ( d.d->sign ==0 )
|
if ( d.d->sign == 0 )
|
||||||
return FP_NZERO;
|
|
||||||
else
|
|
||||||
return FP_PZERO;
|
return FP_PZERO;
|
||||||
} else {
|
|
||||||
if ( d.d->sign ==0 )
|
|
||||||
return FP_NDENORM;
|
|
||||||
else
|
else
|
||||||
|
return FP_NZERO;
|
||||||
|
} else {
|
||||||
|
if ( d.d->sign == 0 )
|
||||||
return FP_PDENORM;
|
return FP_PDENORM;
|
||||||
|
else
|
||||||
|
return FP_NDENORM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d.d->exponent == 0x7ff ) {
|
else if (d.d->exponent == 0x7ff ) {
|
||||||
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
|
if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) {
|
||||||
if ( d.d->sign ==0 )
|
if ( d.d->sign == 0 )
|
||||||
return FP_NINF;
|
|
||||||
else
|
|
||||||
return FP_PINF;
|
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;
|
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. */
|
exponent and a nonzero mantissa. */
|
||||||
|
|
||||||
return (( x.x->exponent == 0x7fff)
|
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 ));
|
&& ( (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. */
|
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 x.x->sign ? -1 : 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue