Subject: Reading 32-bit IEEE floats from binary file ??
From: Robert Dodier
Date: Fri, 24 May 2013 07:47:30 +0000 (UTC)
On 2013-05-24, Henry Baker <hbaker1 at pipeline.com> wrote:
> Is there a Common Lisp package that knows how to read binary format
> 32-bit IEEE floats from a binary file?
There is code in share/numericalio to read and write floats. There is
code for 32-bit floats although it is not very accessible from Maxima
since Maxima prefers 64-bit floats. Of course, one can call the 32-bit
code from Lisp.
Note that there's no guarantee that 32-bit and 64-bit IEEE-754 floats
correspond exactly to Lisp float types. The numericalio code guesses
that double and long floats are 64 bits and short and single are 32
bits. This is incorrect for at least one known Lisp -- GCL, in which all
floats are 64 bits iirc.
See the documentation for read_binary_data, write_binary_data, and
assume_external_byte_order.
best
Robert Dodier