This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
__builtin_isnormal question
- From: Steve Ellcey <sellcey at cavium dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 4 Jun 2018 13:44:12 -0700
- Subject: __builtin_isnormal question
- Reply-to: sellcey at cavium dot com
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
sellcey@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