reading 6-byte ("real48") Borland Pascal Floating Point numbers
nigel at pc714.maths.usyd.edu.au
nigel at pc714.maths.usyd.edu.au
Fri Dec 14 06:18:22 EST 2001
Ron Reidy <rereidy at indra.com> writes:
> Martin Bless wrote:
> >
> > I have to convert those "good (?) old" 6-byte, "real48" floating point
> > numbers used in Borland's Pascal to nowadays "normal" floating points.
> >
> > Has is already been done?
> >
> > Martin
> You will have to do this using pack().
> --
> Ron Reidy
> Oracle DBA
> Reidy Consulting, L.L.C.
The little-known xdrlib in the standard python distro should do
part of the job.
http://www.python.org/doc/current/lib/module-xdrlib.html
>From what I can see in RFC1014 (http://www.faqs.org/rfcs/rfc1014.html)
the XDR and IEEE formats coincide for floating point. The real48 format
(http://www.borland.com/techpubs/delphi/delphi5/oplg/memory.html)
looks similar enough to IEEE that a bit of byte-shifting should do
the conversion, and xdrlib.pack_double(data) gives you your number.
nigel
( at maths. usyd. edu. au )
More information about the Python-list
mailing list