#include #include #include void normalized_demo(){ float f1 = 1.0; printf("%f = 0x%x\n",f1, *((int*) &f1)); float f2 = 1.25; printf("%f = 0x%x\n",f2, *((int*) &f2)); float f3 = 64; printf("%f = 0x%x\n",f3,*((int*) &f3)); float f4 = -.625; printf("%f = 0x%x\n",f4,*((int*) &f4)); } void float_example(){ float f5 = .375; // TODO: replace with answer printf("%f = 0x%x\n",f5, *((int*) &f5)); } void float_exercise(){ float f6 = 47.0; // TODO: replace with answer printf("%f = 0x%x\n", f6, *((int*) &f6)); } void associativity_demo(){ float a = pow(2,30); float b = -1*a; float c = 3.14; printf("(2^30 + -2^30) + 3.14 = %f\n", (a + b) + c); printf("2^30 + (2^30 + 3.14) = %f\n", a + (b + c)); a = 30002; b = 20001; c = 10003; printf("(30002 * 20001) * 10003 = %f\n", (a * b) * c); printf(" 30002 * (20001 * 10003) = %f\n", a * (b * c)); } int main() { normalized_demo(); float_example(); float_exercise(); //associativity_demo(); return 0; }