40 likes | 137 Views
NUMERICAL METHODS M. Antczak , S. Wąsik. Floating point numbers are coded with using equation x = s * 2 c * m , where s – sign (+1,-1) c – attribute (integer value) m – floating point <1/2; 1). Example :. / 2. -2 =. -1 * 2 0 * 2. -1 * 2 1 * 1. / 2. -1 * 2 2 * 1/2.
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