Table of Contents
Intro to Programming Teaching Assistant --- week4
Agenda
Converting between different number systems
IEEE 754 32 bit format for floats
basics of operator associativity
Notes
-
Why is a = (x + i) ++ undefined?
-
Reason
- Increment / decrement operators work only on l-values. Read this
-
$ \ $
-
Converting recurring decimals to binary using ieee format
-
Fix
- Just consider enough bits in the fractional part so that all 23 bits are covered in the final result
- Example: -31.325
-
- Convert -31.325 to IEEE 32 bit floating point representation Convert the fractional part to binary(by repeated multiplication with 2):0.0101 0011 0011 0011 0011 0011 (here 0011 is recurring) Express the combined result to so there is only 1 non-zero integer to the left: 1.1111 0101 0011 0011 0011 0011 0011 × 24.
-
$ \ $
$ \ $