Author: pschweitzer Date: Thu Nov 17 22:38:15 2011 New Revision: 54414
URL: http://svn.reactos.org/svn/reactos?rev=54414&view=rev Log: [CRT] Fix _fpclass. Spotted by: Vincenzo Cotugno Reviewed by: Timo Kreuzer
Modified: trunk/reactos/lib/sdk/crt/float/fpclass.c trunk/reactos/lib/sdk/crt/float/isnan.c
Modified: trunk/reactos/lib/sdk/crt/float/fpclass.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/fpclass.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/fpclass.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/fpclass.c [iso-8859-1] Thu Nov 17 22:38:15 2011 @@ -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 @@ d.__d = &__d;
if ( d.d->exponent == 0 ) { - if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) { - if ( d.d->sign ==0 ) + if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) { + if ( d.d->sign == 0 ) + return FP_PZERO; + else return FP_NZERO; + } else { + if ( d.d->sign == 0 ) + return FP_PDENORM; else - return FP_PZERO; - } else { - if ( d.d->sign ==0 ) return FP_NDENORM; - else - return FP_PDENORM; } } - if (d.d->exponent == 0x7ff ) { - if ( d.d->mantissah == 0 && d.d->mantissal == 0 ) { - if ( d.d->sign ==0 ) + 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 - return FP_PINF; } - 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; }
Modified: trunk/reactos/lib/sdk/crt/float/isnan.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/isnan.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/isnan.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/isnan.c [iso-8859-1] Thu Nov 17 22:38:15 2011 @@ -50,7 +50,7 @@ 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 @@ 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; }