Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MAXFLOAT in Objective-C

Max float is defied as:

math.h

#define    MAXFLOAT    0x1.fffffep+127f

I'm a little sad I never noticed this before. What's this actually say? I would have expected something like this:

#define    MAXFLOAT    0xFFFFFFFF-1

Would that even work?

like image 514
slf Avatar asked Dec 07 '11 17:12

slf


1 Answers

0x1.fffffep+127 is (roughly) 1.99999999999999999999998 times 2^127. It's a floating point number, with an exponent, in hexadecimal.

  • 0x = hex notation
  • 1 = integer part of the number
  • .fffffe = fractional part of the number
  • p+127 = scientific notation for "times two to the 127th power"
like image 51
Scott Forbes Avatar answered Oct 17 '22 03:10

Scott Forbes