The linked lecture explains very nicely two's complement are 15:00. Other great lectures in this series called Programming Paradigm.
Something I liked is that the lecturer explained why two's complement system is used to represent negative numbers. In short basically it makes basic operation like addition and subtraction really easy for hardware and thus fast. Examples are given in the lecture to illustrate.
see near the end of the lecture where representing floating-point numbers is discussed.
#includeint main() { int i = 37; float f = * (float *) &i; printf("%f\n",f); return 0; }
No comments:
Post a Comment