mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 13:11:43 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
58
sdk/lib/crt/float/fpclass.c
Normal file
58
sdk/lib/crt/float/fpclass.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/fpclass.c
|
||||
* PURPOSE: Floating-point classes
|
||||
* PROGRAMER: Pierre Schweitzer (pierre@reactos.org)
|
||||
* REFERENCE: http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <float.h>
|
||||
#include <internal/ieee.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _fpclass(double __d)
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __d;
|
||||
double_s* d;
|
||||
} d;
|
||||
d.__d = &__d;
|
||||
|
||||
|
||||
/* With 0x7ff, it can only be infinity or NaN */
|
||||
if (d.d->exponent == 0x7ff)
|
||||
{
|
||||
if (d.d->mantissah == 0 && d.d->mantissal == 0)
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PINF : _FPCLASS_NINF;
|
||||
}
|
||||
/* Windows will never return Signaling NaN */
|
||||
else
|
||||
{
|
||||
return _FPCLASS_QNAN;
|
||||
}
|
||||
}
|
||||
|
||||
/* With 0, it can only be zero or denormalized number */
|
||||
if (d.d->exponent == 0)
|
||||
{
|
||||
if (d.d->mantissah == 0 && d.d->mantissal == 0)
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PZ : _FPCLASS_NZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PD : _FPCLASS_ND;
|
||||
}
|
||||
}
|
||||
/* Only remain normalized numbers */
|
||||
else
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PN : _FPCLASS_NN;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue