[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
integer-decode-float usage question
Date: Tue, 27 Oct 87 18:44:02 MST
From: email@example.com (Sandra J Loosemore)
Perhaps I'm just being exceptionally dense today, but I'm having a hard
time figuring out how to convert floating point numbers on one machine
into a representation used by another machine (namely, the Motorola FFP
format). I assume that this was the reason why the function
INTEGER-DECODE-FLOAT was provided, but darned if I know how to interpret
the numbers I'm getting back from it -- the exponent of 1.0 is -23?!?
Or is that a bug in the implementation (VaxLisp)? Can anyone shed some
light on the topic?
Having -23 as an exponent makes perfect sense if the first value that
integer-decode-float returns is (expt 2 23) or 8388608, and the
float-radix is 2. You have to look at both values together for the
exponent to make sense. To get the 1.0 back from the
integer-decode-float values do (scale-float (float 8388608) -23).
Which is (expt 2 (+ 23 -23)) or 1.