Академический Документы
Профессиональный Документы
Культура Документы
This lesson is next and final step before we start to code. It is about decoding
numbers and saving them into computer using IEEE protocols for standard and
double precision. Normalization procedures are shown precisely and are really
easy to understand.
6 = 1102 * 20 = 1.12 * 22 = 0100 0000 1100 0000 ... 0000 0000 = 40C0 0000 hex
1 = 12 * 20 = 0011 1111 1000 0000 ... 0000 0000 = 3F80 0000 hex
K = 0 + 127 (01111111).
.75 = 0.112 * 20 = 1.12 * 2-1 = 0011 1111 0100 0000 ... 0000 0000 = 3F40 0000
hex
Special Case - 0:
Normalization of number 0 can t produce shape 1.xxxxx
0 = 0 0000000 0000 ... like 1.02 * 2-127
Range and precision of Real Numbers:
In case of Real number of standard precision, characteristic (8 bits) can be
somewhere in interval [0,255].
K = 0 reserved to display zero
K = 255 reserved to display infinity
While BE = K - 127, BE can be created in interval [-126,127].
Smallest positive number different than zero which can be displayed:
1.02 * 2 126 ~ 1.175494350822*10 38
and the biggest is:
1.111111111111111111111112 * 2127 ~2128 = 3.402823669209*1038
Precision: 24 binary digits
<!--[if !vml]-->224 ~ 10x 24 log 2 ~ x log 10 x ~ 24 log 2 ~
7.224719895936<!--[endif]--> <!--[if !vml]--><!--[endif]-->
about first 7 digits are valid correct.
Display by numerical line:
Numerical mistake:
Not possible to use all bits while calculating:
Example: 0.000110 + 0.990010
0.000110 : (1.)101000110110111000101112 * 2-14
0.990010 : (1.)111110101110000101000112 * 2-1
While adding, binary spots must be one underneath the other:
#.000000000000011010001101 * 20 Only 11 of 24 bits!
+.111111010111000010100011 * 20
<!--[if !vml]--> =.111111010111011100110000 * 20 =
0,990099906921410<!--[endif]-->
Real numbers in double precise mode
Declaration in program language C:
double
Pforsign ( P=1 negative, P=0 positive)
Characteristicbinary exponent + 1023 (11 bits)
Mantissanormalized (52+1 bit).
Range:
K [0,2047].
K = 0 reserved for display of zero
K = 2047 reserved for display infinity
BE = K - 1023
BE [-1022,1023]
Smallest positive number different than zero which can be displayed:
1.02 * 2 1022 ~ 2.225073858507*10 308
and the biggest is:
1.1111.....1111112 * 21023 ~ 21024 = 1.797693134862316*10308
Correct: 53 binary numbers
<!--[if !vml]-->253 ~ 10x 53 log 2 ~ x log 10 x ~ 53 log 2 ~
15.95458977019<!--[endif]--> <!--[if !vml]--><!--[endif]-->
near to 16 first numbers are valid.
There is also:
long double 80 bits
Characteristic: 15 bits
Binary exponent: Characteristic - 16383
Real constants
1. 2.34 9e-8 8.345e+25 double
2f 2.34F -1.34e5f float
1.L 2.34L -2.5e-37L long double