dannystaple / AmosPy

Python code to try and detokenise Amos files. Very very alpha.
MIT License
7 stars 2 forks source link

Fix float parsing #4

Closed dschwen closed 10 years ago

dschwen commented 10 years ago

Decode AMOS float values properly (closes #3). I suggest not adding a Float word in the detokenized output (AMOS doesn't do that either). Also we might want to limit the number of digits shown to reflect the lower 32bit float precision.

dschwen commented 10 years ago

A reasonable goad might be to create output that is as compatible as possible with http://sourceforge.net/projects/xamos

dannystaple commented 10 years ago

Hi - merging this. I wander if an unpack string could eliminate the C style bit-banging below - it should work, but doesn't look very pythonic.

dannystaple commented 10 years ago

I suspect someone could also add some byte streams of floats to the tests from some real examples - and have travis test this part.

dschwen commented 10 years ago

I doubt unpack can be made to work. After all the Amos floats are not IEEE ( https://en.wikipedia.org/wiki/Single-precision_floating-point_format#IEEE_754_single-precision_binary_floating-point_format:_binary32)

dannystaple commented 10 years ago

I was thinking along the lines of unpacking the bytes and so on - so you don't need the shifts and masks. I get what you mean about the float not being the right representation though.

On 11 October 2014 23:08, Daniel Schwen notifications@github.com wrote:

I doubt unpack can be made to work. After all the Amos floats are not IEEE ( https://en.wikipedia.org/wiki/Single-precision_floating-point_format#IEEE_754_single-precision_binary_floating-point_format:_binary32 )

— Reply to this email directly or view it on GitHub https://github.com/dannystaple/AmosPy/pull/4#issuecomment-58766322.

Danny Staple Director, ODM Solutions Ltd w: http://odmsolutions.co.uk blog: http://dannystaple.github.io