Is there a bug in __builtin_isnormal or am I just confused as to what it means? There doesn't seem to be any actual definition/documentation for the function. __builtin_isnormal(0.0) is returning false. That seems wrong to me, 0.0 is a normal (as opposed to a denormalized) number isn't it? Or is zero special?
Steve Ellcey sell...@cavium.com #include <math.h> #include <stdio.h> #include <values.h> int main() { double x; x = 0.0; printf("%e %e %e\n", x, DBL_MIN, DBL_MAX); printf("normal is %s\n", __builtin_isnormal(x) ? "TRUE" : "FALSE"); x = 1.0; printf("%e %e %e\n", x, DBL_MIN, DBL_MAX); printf("normal is %s\n", __builtin_isnormal(x) ? "TRUE" : "FALSE"); return 0; } % gcc x.c -o x % ./x 0.000000e+00 2.225074e-308 1.797693e+308 normal is FALSE 1.000000e+00 2.225074e-308 1.797693e+308 normal is TRUE