float separationn

Mark McIntyre markmcintyre at spamcop.net
Wed May 15 18:54:16 EDT 2002


On Wed, 15 May 2002 23:58:46 +0200, Wolfgang Draxinger
<wdraxinger at darkstargames.de> wrote:

>This is not really C/C++ related, but I think this is also a place to ask:
>I'm currently working on a compressed 3D Object interchange format.
>With C/C++ its no problem to raw-write the IEEE standard floats the data 
>consists of into files. Now I'm writing some export scripts for blender 
>in python. My problem is, that the python float object doesn't provide a 
>raw-data access. What I need now, is some possibility to construct the 
>IEEE float format from data returned by the standard math functions.
>I think frexp() is a good start, however this still returns a float 
>value. I'd like to have the raw bits...

This is not language specific, but implementation specific. However,
you could probably copy the floating point value into an array of
unsigned chars, and then extract the relevant bits, assuming you know
the widths of the parts of the floating point format used. 
>
>Some ideas?
>
>Thanks
>Wolfgang Draxinger

-- 
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>



More information about the Python-list mailing list