Reputation: 429
I tried looking at the float.h header file and all I found was
# define FLT32_MAX FLT_MAX
However, shouldn't it be
# define FLT_MAX (some number)
but I can't find this kind of definition and so I wonder where would the defintion of the FLT_MAX macro be?
Upvotes: 1
Views: 10973
Reputation: 263347
In C, the macro FLT_MAX
is defined in the standard header <float.h>
.
Examining a file named float.h
on your system and not finding a definition of FLT_MAX
doesn't prove anything. You might be looking at the wrong file. Conceivably <float.h>
might not even be a file. Or float.h
might be the right file, but it might get the FLT_MAX
definition from something it includes.
This program:
#include <stdio.h>
#include <float.h>
int main(void) {
printf("FLT_MAX = %g\n", FLT_MAX);
}
should compile and run without error. If it doesn't, your system is broken somehow. If it does, you may be able to coax your compiler to tell you where it found <float.h>
. For example, if you're using gcc on a UNIX-like system:
gcc -E
filename.c | grep 'float\.h'
The <float.h>
header should not define a macro named FLT32_MAX
, at least not in conforming mode. That's non-standard and it's in the user name space, so a program should be able to use that name for its own purposes.
Upvotes: 10