Created
July 3, 2019 14:03
-
-
Save benaryorg/41054af1a9f517fc43b23660661707fe 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
#include <stdio.h> | |
union fi | |
{ | |
unsigned i; | |
float f; | |
}; | |
int main(void) | |
{ | |
union fi fi = { .f = 16777000.0 }; | |
while(((float)(fi.f += 1.0)) != ((float)(fi.f+1.0))) | |
{ | |
printf("%.1f (%u) + 1.0 = %.1f (%.1lf)\n",fi.f,fi.i,(float) (fi.f+1.0),((double) fi.f)+1.0); | |
} | |
printf("%.1f (%u) + 1.0 = %.1f (%.1lf)\n",fi.f,fi.i,(float) (fi.f+1.0),((double) fi.f)+1.0); | |
fi.i++; | |
printf("%.1f (%u) + 1.0 = %.1f (%.1lf)\n",fi.f,fi.i,(float) (fi.f+1.0),((double) fi.f)+1.0); | |
printf("16777216.0f %c= 16777217.0f\n",(16777216.0f == 16777217.0f) ? '=' : '!'); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment