Last active
February 18, 2021 07:26
-
-
Save phc15/56dad9900d8e71c625869c06d0d5b3ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float fl, fltest, last; | |
fl = 0.0; // check if the float number is NaN | |
while(fl == 0.0) { | |
last = fltest; | |
fltest += 1.111e+31; // sign bit 1 + exponent 8 bits + mantissa 23 bits | |
if((fl = (fl + fltest) + (-fltest)) != 0.0) { // 0.0 +∞ + (-∞) == NaN | |
break; | |
} | |
} | |
printf("Unsigned float max: %e", last); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment