Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenfpclass.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS system libraries 00004 * FILE: lib/sdk/crt/float/fpclass.c 00005 * PURPOSE: Floating-point classes 00006 * PROGRAMER: Pierre Schweitzer (pierre@reactos.org) 00007 * REFERENCE: http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml 00008 */ 00009 00010 #include <precomp.h> 00011 #include <float.h> 00012 #include <internal/ieee.h> 00013 00014 /* 00015 * @implemented 00016 */ 00017 int _fpclass(double __d) 00018 { 00019 union 00020 { 00021 double* __d; 00022 double_s* d; 00023 } d; 00024 d.__d = &__d; 00025 00026 00027 /* With 0x7ff, it can only be infinity or NaN */ 00028 if (d.d->exponent == 0x7ff) 00029 { 00030 if (d.d->mantissah == 0 && d.d->mantissal == 0) 00031 { 00032 return (d.d->sign == 0) ? _FPCLASS_PINF : _FPCLASS_NINF; 00033 } 00034 /* Windows will never return Signaling NaN */ 00035 else 00036 { 00037 return _FPCLASS_QNAN; 00038 } 00039 } 00040 00041 /* With 0, it can only be zero or denormalized number */ 00042 if (d.d->exponent == 0) 00043 { 00044 if (d.d->mantissah == 0 && d.d->mantissal == 0) 00045 { 00046 return (d.d->sign == 0) ? _FPCLASS_PZ : _FPCLASS_NZ; 00047 } 00048 else 00049 { 00050 return (d.d->sign == 0) ? _FPCLASS_PD : _FPCLASS_ND; 00051 } 00052 } 00053 /* Only remain normalized numbers */ 00054 else 00055 { 00056 return (d.d->sign == 0) ? _FPCLASS_PN : _FPCLASS_NN; 00057 } 00058 } Generated on Sun May 27 2012 04:36:28 for ReactOS by
1.7.6.1
|