1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #include <openlibm_math.h>
- #include "math_private.h"
- #include "fpmath.h"
- OLM_DLLEXPORT int
- __fpclassifyd(double d)
- {
- union IEEEd2bits u;
- u.d = d;
- if (u.bits.exp == 2047) {
- if (u.bits.manl == 0 && u.bits.manh == 0) {
- return FP_INFINITE;
- } else {
- return FP_NAN;
- }
- } else if (u.bits.exp != 0) {
- return FP_NORMAL;
- } else if (u.bits.manl == 0 && u.bits.manh == 0) {
- return FP_ZERO;
- } else {
- return FP_SUBNORMAL;
- }
- }
-
- OLM_DLLEXPORT int
- __fpclassifyf(float f)
- {
- union IEEEf2bits u;
- u.f = f;
- if (u.bits.exp == 255) {
- if (u.bits.man == 0) {
- return FP_INFINITE;
- } else {
- return FP_NAN;
- }
- } else if (u.bits.exp != 0) {
- return FP_NORMAL;
- } else if (u.bits.man == 0) {
- return FP_ZERO;
- } else {
- return FP_SUBNORMAL;
- }
- }
- #ifdef LONG_DOUBLE
- OLM_DLLEXPORT int
- __fpclassifyl(long double e)
- {
- union IEEEl2bits u;
- u.e = e;
- mask_nbit_l(u);
- if (u.bits.exp == 32767) {
- if (u.bits.manl == 0 && u.bits.manh == 0) {
- return FP_INFINITE;
- } else {
- return FP_NAN;
- }
- } else if (u.bits.exp != 0) {
- return FP_NORMAL;
- } else if (u.bits.manl == 0 && u.bits.manh == 0) {
- return FP_ZERO;
- } else {
- return FP_SUBNORMAL;
- }
- }
- #endif
|