IEEE 754 standard Start by putting number in scientific style notation. Example of a binary real number in scientific notation: 1001101.11011 = 1.00110111011 * 2^6 (hybrid representation) Exponent also in binary 1001101.11011 = 1.00110111011 * 2^0110 Stored representation divided into three sub-units Sign bit 0 = + 1 = - Significant digits known as the matissa or significand Exponent to what power is 2 raised (also needs to handle sign). IEEE 754 standards Single precision 32 bit - 8 bit exponent, 23 bit significand, 1 bit for sign Double precision 64 bit - 11 bit exponent, 52 bit significand, 1 bit for sign High (quadruple) precision (?) >79 bits 80 bit - 15 bit exponent, 64 bit significand, 1 bit for sign 128 bit - 15 bit exponent, 112 bit significand, 1 bit for sign Zero Both exponent and significand set to zero, sign bit may be either. Infinity Exponent all 1s and significand set to zero NAN - not a number. Exponent all 1s and significand not zero Denormalized. Exponent zero and significand not zero. Normalizing the number .431. .0110111001010110000001000 Using the equivalent of scientific notation. 1.10111001010110000001000 * 2^-2 In standard scientific notation: Integer has range from 1 - 9 and must be preserved. However in binary form, only possible value is 1 and can be implied. So only decimal portion needs to be stored. .10111001010110000001000 This allows for 1 extra digit of precission. With 23 bit precision, a very close approximation can be found. Generating a IEEE 754 bias. Because values can be greater or less than 1 Exponent must represent both positive and negative values. Problem: an exponent of zero used to flag special conditions. Solution: shift (bias) definition of zero exponent up the number line. Using single precision float with 8 bit exponent. Giving a range of 0 to 255 that should represent a signed exponent. Need to reserve 0 and 255 (11111111b) as flag values. Giving a number range between 1 and 254 to represent an exponent. That represents an exponent in the range of -127 to 126. Shift representation of exponent 0 to middle of range. Called the Bias - 2^(n-1) - 1 where n is the size of the exponent. 3 bit exponent bias example 2^(3-1)-1 = 3 bias Normal: 100 101 110 111 000 001 010 011 -4 -3 -2 -1 0 1 2 3 Biased: 000) 001 010 011 100 101 110 (111 RES. -2 -1 0 1 2 3 RES. Bias for example using 8 bit exponent and putting it together. Calculate bias 2^(8-1)-1 = 127 bias Normalize binary real number and find exponent 1.10111001010110000001000 * 2^-2, Bias the exponent 127 - 2 = 125 = 0111 1101 Set sign bit Sign bit 0 (positive) Biased Exponent 0111 1101 Signficand 1011 1001 0101 1000 0001 000 Floating point 0 01111101 10111001010110000001000