40 likes | 143 Views
Learn the fundamentals of floating point numbers and binary representation in numerical methods. Explore how to code floating point numbers using equations, understand binary representation, and work with recurrence functions.
E N D
NUMERICAL METHODS M. Antczak, S. Wąsik
Floating point numbers are coded with using equation • x = s * 2c * m, • where • s – sign (+1,-1) • c – attribute (integer value) • m – floating point <1/2; 1) Example: / 2 -2 = -1 * 20 * 2 -1 * 21 * 1 / 2 -1 * 22 * 1/2 s = -1 c = 2 m=1/2
Binaryrepresentation of floating point b1b2b3b4… • m = b1/2 + b2/4 + b3/8 + .. + bt/2t • where • t – number of bits Example (t = 5 bits): ≥ Yes 1 0 ≥ No ≥ Yes 1 0 0 ≥ No Finally: 10100 0 0 ≥ No
Recurrence function example: recurrencestoppingcondition recurrencerule Example: n = 5 => silnia(5) 5 * silnia(4) 120 24 4 * silnia(3) 6 3 * silnia(2) 2 * silnia(1) 2 1