On Nov 10, 7:20 pm, "john.goodleaf" <[EMAIL PROTECTED]> wrote: > does anyone know of an already-done means of writing > integers and floats out to their IBM mainframe equivalents? >
I don't know of anything in Python that does this. There was a thread a while ago that may be relevant: http://mail.python.org/pipermail/python-list/2004-March/255361.html and Googling 'IBM VAX double conversion' produces some tools that convert between IEEE, IBM and VAX double formats. I'm not quite sure what you're after here: I assume that you're working on some type of modern non-IBM (and therefore presumably IEEE 754-based) hardware, and you want to be able to convert IEEE doubles to IBM style doubles. Is that right? It shouldn't be too difficult to write routines, making use of math.ldexp and math.frexp. The fun part would be deciding how to handle NaNs and infinities when encoding to IBM format, and how to handle out-of-range floats coming back (if I recall correctly, the IBM format allows a wider range of exponents than IEEE). Mark -- http://mail.python.org/mailman/listinfo/python-list