/* * A simple program that demonstrates floating point formats * */ #include <stdio.h> int main(int argc, char* argv[]) { int a = 0x80000000; int b = 0x40000000; int c = 0xFF800000; int d = 0x7FF00000; float *a1 = &a; float *b1 = &b; float *c1 = &c; float *d1 = &d; printf("a = %f\tb = %f\tc = %f\td = %f\n", *a1, *b1, *c1, *d1); // This won't work because a promotion to float actually converts the bits. //printf("a = %f\tb = %f\tc = %f\td = %f\n", //(float)a, (float)b, (float)c, (float)d); return 0; }