Data Conversion 

advertisement
Data Conversion
  Anorm  2 IK  2 IK /14  B(2)  214 B(3)  228 B(4)  242 B(5)  256 B(6)  (1.1)
There are 64 bits in the word. Twelve are used for the exponent. One is used for the sign, and IEEE
gains one by starting the term with an implied 1. Thus Anum is an integer less than or equal to 254. The
B(I)’s are less than IB-214=16384.
The code as of 12/12/2008 is in dmp.zip. This code begins with (214)i-75 to all powers relevant to double
precision stored in the vector Bv(j), j=1 to 148. The value of j such that Bv(j)<α<Bv(j+1) is found using
Locate. This j is used to define MP(1)=IK/14. Then a series of multiplications by 214 and subtractions of
the appropriate integers is used to find MP(2) through MP(6) which are the values of B(2) through B(6)
in (1.1).
Finding log2(2)
ln    Ix ln  2  ln  Anorm
Ix=log/log2
test1.zip – a set of powers of 2 subjected to this
C:\Public\temp\TestPrecision>TPREC
I, T=
1020 -1020.0000000000000000
I, T=
1021 -1021.0000000000000000
I, T=
1022 -1022.0000000000000000
I, T=
1023 -1023.0000000000000000
*ERR* KO-02 floating-point overflow
1020.0000000000000000
1021.0000000000000000
1022.0000000000000000
1023.0000000000000000
A second test includes a random value for Anum and its recovery test2.zip
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Public\temp\TestPrecision>TPREC
1020 0.8825319376116749E+00 0.8825319376116749E+00
1020 0.8661993731579385E+00 0.8661993731579385E+00
1020 0.6758844057879534E+00 0.6758844057879534E+00
1020 0.5661869336760950E+00 0.5661869336760950E+00
0.8825319376116749E+00
0.8661993731579385E+00
0.6758844057879534E+00
0.5661869336760950E+00
Find IK and Anorm
test3.zip is a code that finds the power of 2 and a product anorm that is between .5 and 1.
The extension of this is to find a power of b=214 times a number between 2-14 and 1. This number
subtracted from the original will give the second term needed to find a real*8 term, then again for a
total of at most 6 terms.
Entering a number
The number above is also entered into the code
10011110001101101111011100001010  IA(1) – differs by 3 in last byte – tests show that a range of
values here produce the same floating point value
00111111101111000011110110110011  IA(2)
00000000
00000000000000000000000000000000
3F100000
00111111000100000000000000000000
½14 is represented in the exponent alone. This gives fast exact multiplications of real numbers. The
same is true of 214
Download