CSC207H1 Lecture : nov28c.docx
Document Summary
Representing numbers: it all makes sense if you understand how real numbers are represented, first, consider an int like 42. Hardware doesn"t directly represent 4s or 2s -- everything is binary: so 42 can be represented by 101010 (base 2). Of course, the binary digits are represented electromagnetically. Representing fractions: fractions can be handled using the same approach, so 0. 4375 can be represented by using 0. 0111 (base 2, another example. Problem numbers: you already know from math that some numbers do not have a finite representation, even worse, some numbers that have a finite representation in decimal do not in binary, we have finite memory. But we need to represent numbers that take an infinite number of bits. Ieee-754 floating point: like a binary version of scientific notation, 32 bits for a float as follows: (and 64 bits for a double) 1 bit for the sign: 1 for negative and 0 for positive.