4 /* ibm2flt wesley ebisuzaki
7 * v1.1 .. if mant == 0 -> quick return
12 double ibm2flt(unsigned char *ibm
) {
15 unsigned int abspower
;
19 mant
= (ibm
[1] << 16) + (ibm
[2] << 8) + ibm
[3];
20 if (mant
== 0) return 0.0;
22 positive
= (ibm
[0] & 0x80) == 0;
23 power
= (int) (ibm
[0] & 0x7f) - 64;
24 abspower
= power
> 0 ? power
: -power
;
38 if (power
< 0) value
= 1.0 / value
;
39 value
= value
* mant
/ 16777216.0;
40 if (positive
== 0) value
= -value
;