2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
9 CONVERTS FLOATING POINT TO EXTENDED FORMAT
11 Two sizes of FLOATING Point are known:
14 /********************************************************/
16 It is not required to normalize in extended
17 format, but it has been chosen to do so.
18 Extended Format is as follows (at exit):
20 ->sign S000 0000 | 0000 0000 <SIGN>
21 ->exp 0EEE EEEE | EEEE EEEE <EXPONENT>
22 ->m1 LFFF FFFF | FFFF FFFF <L.Fraction>
23 FFFF FFFF | FFFF FFFF <Fraction>
24 ->m2 FFFF FFFF | FFFF FFFF <Fraction>
25 FFFF F000 | 0000 0000 <Fraction>
27 /********************************************************/
33 /********************************************************/
47 #if FL_MSL_AT_LOW_ADDRESS
48 #if FL_MSW_AT_LOW_ADDRESS
49 to
->exp
= uget2(cpt1
);
51 to
->exp
= uget2(cpt1
+2);
54 #if FL_MSW_AT_LOW_ADDRESS
55 to
->exp
= uget2(cpt1
+(size
== sizeof(DOUBLE
) ? 4 : 0));
57 to
->exp
= uget2(cpt1
+(size
== sizeof(DOUBLE
) ? 6 : 2));
60 to
->sign
= (to
->exp
& 0x8000); /* set sign bit */
62 if (size
== sizeof(DOUBLE
))
63 to
->exp
>>= DBL_EXPSHIFT
;
65 to
->exp
>>= SGL_EXPSHIFT
;
67 leadbit
++; /* will set Lead bit later */
70 if (size
== sizeof(DOUBLE
)) {
71 #if FL_MSL_AT_LOW_ADDRESS
80 if (to
->exp
== 1 && to
->m1
== 0 && tmp
== 0) {
87 to
->m1
<<= DBL_M1LEFT
; /* shift */
88 to
->exp
-= DBL_BIAS
; /* remove bias */
89 to
->m1
|= (tmp
>>DBL_RPACK
); /* plus 10 == 32 */
90 to
->m2
= (tmp
<<DBL_LPACK
); /* plus 22 == 32 */
92 else { /* size == sizeof(SINGLE) */
94 to
->m1
<<= SGL_M1LEFT
; /* shift */
95 if (to
->exp
== 1 && to
->m1
== 0) {
102 to
->exp
-= SGL_BIAS
; /* remove bias */
106 to
->m1
|= NORMBIT
; /* set bit L */
107 if (leadbit
== 0) { /* set or clear Leading Bit */
108 to
->m1
&= ~NORMBIT
; /* clear bit L */
109 nrm_ext(to
); /* and normalize */