Files
Upsilon/liba/src/fpclassify.c
Émilie Feral 818c56bd45 [python] Enable float
Change-Id: I94111dd821fb3a9ef1e22ae5133c3a48285c52d5
2017-08-25 11:20:49 +02:00

21 lines
371 B
C

#include <math.h>
#include <private/ieee754.h>
int __fpclassify(double x) {
if (ieee754exp64(x) == 0) {
if (ieee754man64(x) == 0x0) {
return FP_ZERO;
} else {
return FP_SUBNORMAL;
}
}
if (ieee754exp64(x) == 0x7FF) {
if (ieee754man64(x) == 0) {
return FP_INFINITE;
} else {
return FP_NAN;
}
}
return FP_NORMAL;
}