Professional Documents
Culture Documents
Computable reals
computable numbers may be described briefly as the real numbers whose expressions as a decimal are calculable by finite means.(A. M. Turing,
On Computable Numbers with an Application to the Entschiedungsproblem, Proc. London Mathematical Soc., Ser. 2 , Vol 42, pages 230-265, 1936-7.)
Transcendental numbers
In principle, transcendental numbers such as Pi or root 2 have no finite representation We are always dealing with approximations to them. We can still treat Pi as a real rather than a rational because there is always an algorithmic step by which we can add another digit to its expansion.
First solution
Store the numbers in memory just as they are printed as a string of characters. 249.75 Would be stored as 6 bytes as shown below Note that decimal numbers are in the range 30H to 39H as ascii codes
Char for 3 32 34 39
Implications
The number strings can be of variable length. This allows arbitrary precision. This representation is used in systems like Mathematica which requires very high accuracy.
Representing variables
Variables are represented as pointers to character strings in this system A=249.75
A 32 34 39 2E 37 35
Advantages
Arbitrarily precise Needs no special hardware Disadvantages Slow Needs complex memory management
32 bits overall
Normalise
Convert N to format with one digit in front of the decimal point as follows: 1. If N>10 then Whilst N>10 divide by 10 and add 1 to the exponent 2. Else whilst N<1 multiply by 10 and decrement the exponent
Mathematica
In[1]:= 325000000 + 108 Out[1]=
325000108
Single Precision
Definition
N=-1s x 1.F x 2E-128 Delete this bit Example 1 3.25 In fixed point binary = 11.01 = 1.101 x 21 In IEEE format this is s=0 E=129, F=10100 thus in IEEE it is
S E F 0|1000 0001|1010 0000 0000 0000 0000 000
Example 2
-0.375 = -3/8 In fixed point binary = -0.011 =-11 x 1.1 x 2-2 In IEEE format this is s=1 E=126, F=1000 thus in IEEE it is
S E F 1|0111 1110|1000 0000 0000 0000 0000 000
Range
IEEE32 1.17 * 1038 to +3.40 * 1038 IEEE64 2.23 * 10308 to +1.79 * 10308 80bit 3.37 * 104932 to +1.18 * 104932