CSL now has some more functions to help with floating point. To get access
to these you will need to rebuild your Reduce image I expect. These are in
the lastest subversion.
Reduce (Free CSL version), 21-Aug-10 ...
1: lisp;
nil
2* decode!-float (-1024.0);
(-1.0 11 0.5)
This is basically FREXP and gives you sign, exponant and mantissa. There
ought not be to any rounding etc in the process.
3* integer!-decode!-float (-1024.0);
(4503599627370496 -42 -1)
Much the same except that the mantissa is returned as an integer of
52 bits. Except of course when the input is 0.0. This gives access to the
bitwise representationof the float.
4* scale!-float(1.0, 10);
1024.0
This one is as in ldexp and scales by a factor of 2 by addint in exponent
bits.
5* rational 3.125;
(25 . 8)
If the float concerned denotes a neat rational numbet the dotted pair you
get back will be that.
6* rational exp 1.0;
(6121026514868073 . 2251799813685248)
Note that the quotient of those two integers is close to "e", and the
second of them is a power of 2. So this is rather like doing
integer-decode-float but then using the exponent to get an integer power
of 2.
7* rational 1.0e22;
10000000000000000000000
This may return an integer not a dotted pair if a fraction is not needed.
8* rational 1.0e77;
99999999999999998278261272554585856747747644714015897553975120217811154108416
The exact integer value denoted by the floating point representation.
Which is a 52-bit number multiplied by 2^21, as integer-decode-float would
tell you.
If there were documentation anywhere I might merge this email into it!
Arthur