Extract double in binary file
tjreedy at udel.edu
Wed Nov 26 17:55:43 CET 2003
"Gandalf" <gandalf at geochemsource.com> wrote in message
news:mailman.1105.1069859877.702.python-list at python.org...
> >I've a binary file with data in it.
> >This file come from an old ms dos application (multilog ~ 1980).
> >In this application, a field is declared as a 'decimal' (999 999
> >I put 0.00 in the field and save the record to the file.
> >When I look in the binary file (with python or an hex editor), the
> >field is stored on 8 bytes: 00-00-00-00-00-00-7F-00.
> >I try unpack from struct module but the result isn't good.
> >Can someone help me?
> Most likely it is a BCD field.
I believe hex OP gave is for double 0.0e0 (exponents are biased).
OTOH, BCD for 11 digits would be 6 bytes, all 0, which also has.
Putting -1.0 and 1.0 in field and storing would clarify storage format
if really not known.
More information about the Python-list