"Everything in your computer is JUST BYTES." --ajq 1 byte = 8 bits Range (unsigned) of a byte is 0 to 255. ON OUR PLATFORM double is 8 bytes (64 bits) float is 4 bytes (32 bits) You do not need to remember that. ---------------------------------------- SCIENTIFIC NOTATION base 10 scientific notation (sign, mantissa, base, exponent) 0.375 = 3.75 x 10⁻¹ 3₁₀ x 2⁻³ = 3₁₀ x ⅛ = 11₂ x 2⁻³ ---------------------------------------- x/1gt &d x/ is a command to examine memory 1 is the # of those units (↓) g is the unit size; g is for 8 bytes ("giant word") t is the format; t is for binary bits --- &d means "address of d" ---------------------------------------- 5.505 0100000000010110000001010001111010111000010100011110101110000101 ----+----1----+----2----+----3----+----4----+----5----+----6---- Goal: Extract the sign, mantissa, and exponent from those bits. ----+----1----+----2----+----3----+----4----+----5----+----6---- 0100000000010110000001010001111010111000010100011110101110000101 SEEEEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM │└────┬────┘└───────────────────────┬──────────────────────────┘ s exponent mantissa i g n sign bit: 0 --- 0 means positve number; 1 means negative number; will multiply by (-1)^sign exponent bits (×11): 10000000001 == 1025 -- subtract 1023 to get the real exponent: 2 mantissa bits (×52): 0110000001010001111010111000010100011110101110000101 1.↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ 0110000001010001111010111000010100011110101110000101 mantissa = 1 + ──────────────────────────────────────────────────── 2⁵² 0110000001010001111010111000010100011110101110000101 mantissa = 1 + ───────────────────────────────────────────────────── 10000000000000000000000000000000000000000000000000000 1694479359798149 mantissa = 1 + ──────────────── 4503599627370496 (-1)⁰ × ....... × 2⁽¹⁰²⁵⁻¹⁰²³⁾ 4503599627370496 ---------------------------------------- POSITIONAL NOTATION (aka "decimal numbers") Base 10 (decimal) positional notation 0.375 = 0 x 1 0 x 10⁰ 3 x 0.1 3 x 10⁻¹ 7 x 0.01 7 x 10⁻² + 5 x 0.001 5 x 10⁻³ = 375 x 0.001 375 x 10⁻³ Base 2 (binary) positional notation = 0 x 1 0 x 2⁰ 0 x ½ 0 x 2⁻¹ 1 x ¼ 1 x 2⁻² 1 x ⅛ 1 x 2⁻³ = 11₂ x 2⁻³ = 3 x 1/8 = 0.375 -------------------------------------------------------------------------------- 0.375 = a * 10^b a and b are whole numbers. 0.33… = (can't ... but in base-3 we could) 5.505 = a * 10^b a==375 b==-3 Can't do that in base-2. 5.505 == a x * 2^b