Python on non IEEE-754 platforms: plea for information.
A request for information: What non IEEE 754 platforms exist that people care about running Python 2.6, Python 3.0 and higher on? By non IEEE 754 platform, I mean a platform where either the C double is not the usual 64-bit IEEE floating-point format, or where the C double is IEEE format but the platform deviates in major ways from the IEEE 754 specification. There are a few places (mostly in mathmodule.c, cmathmodule.c, floatobject.c, longobject.c) where it's not clear that the code behaves correctly on non-IEEE platforms, and I'm finding it difficult to determine how broken (or not) it is without having a clear idea of what possible unusual floating-point formats might come up. The major non-IEEE floating-point formats that I know of, on big iron, are the VAX, Cray and IBM formats; I believe anything else is too old to worry about. Is this true? The IBM format is particularly troublesome because it's base 16 instead of base 2 (so e.g. multiplying a float by 2 can lose bits), but it appears that recent IBM machines do both IBM format and IEEE format floating-point. I assume that the S-390 buildbots are using the IEEE side---is this true? At the other end of the spectrum are embedded devices and cellphones. Here I have no idea what the situation is at all---any information would be valuable. Mark
Mark Dickinson wrote:
At the other end of the spectrum are embedded devices and cellphones. Here I have no idea what the situation is at all---any information would be valuable.
I know two mobile phone platforms for Python: Nokia S60 and Pippy for Palm. I haven't had time to study Python on Nokia S60 Series yet. Palm's hardware and Pippy don't support floats at all. Pippy Python is an old 1.5 (?) without the float type. The third major platform and last platform for mobile devices I can think for right now are Qtopia and WinCE. I haven't dealt with them either so you've to check the specs. Python on Nokia S60 Series: (Python 2.2.x) http://www.forum.nokia.com/info/sw.nokia.com/id/ee447e84-2851-471a-8387-3434... http://wiki.opensource.nokia.com/projects/Python_for_S60 Pippy: http://pippy.sourceforge.net/ Qtopia: http://en.wikipedia.org/wiki/Qtopia http://www.trolltech.com/products/qtopia/ WinCE: http://en.wikipedia.org/wiki/WinCE Christian
What non IEEE 754 platforms exist that people care about running Python 2.6, Python 3.0 and higher on?
VMS, that's even supported to some degree in the source tree, and OS/390 (aka z/OS); patches to support it have been rejected, but people will likely maintain a fork themselves.
The major non-IEEE floating-point formats that I know of, on big iron, are the VAX, Cray and IBM formats; I believe anything else is too old to worry about. Is this true?
Mostly. For VAX, there exist two double formats: the D format, and the G format - not sure whether you counted them as two.
The IBM format is particularly troublesome because it's base 16 instead of base 2 (so e.g. multiplying a float by 2 can lose bits), but it appears that recent IBM machines do both IBM format and IEEE format floating-point. I assume that the S-390 buildbots are using the IEEE side---is this true?
They run Linux, so yes. Notice that other people also run Python on z/OS. Regards, Martin
On Feb 1, 2008 7:56 PM, "Martin v. Löwis"
Mostly. For VAX, there exist two double formats: the D format, and the G format - not sure whether you counted them as two.
I didn't. Thanks.
They run Linux, so yes. Notice that other people also run Python on z/OS.
Okay. So FLT_RADIX==2 can't be assumed, in general. Thanks for the information. Mark
Mark Dickinson wrote:
At the other end of the spectrum are embedded devices and cellphones. Here I have no idea what the situation is at all---any information would be valuable.
I spoke to Mikko Ohtamaa (Moo-- on #pys60) and he gave me the name of a Nokia developer and this link http://discussion.forum.nokia.com/forum/showthread.php?t=97263. I already contacted the developer and asked him to reply here. Christian
On Feb 1, 2008 8:04 PM, Christian Heimes
I spoke to Mikko Ohtamaa (Moo-- on #pys60) and he gave me the name of a Nokia developer and this link http://discussion.forum.nokia.com/forum/showthread.php?t=97263. I already contacted the developer and asked him to reply here.
Thank you: a very useful thread. From what little information I'm turning up on Google, it looks as though most of these devices---if they support floating-point at all---provide some reasonably close approximation to IEEE 754 floats (possibly emulated in software).
Mark Dickinson wrote:
Thank you: a very useful thread. From what little information I'm turning up on Google, it looks as though most of these devices---if they support floating-point at all---provide some reasonably close approximation to IEEE 754 floats (possibly emulated in software).
Some of the devices have a (slow) floating point engine. But it's sometimes disabled to safe power or userland software can't sometimes access the FPU. Some devices can (ab)use the DSP or GPU/OpenGL engine to speed up floating point ops. Christian
On Feb 1, 2008 2:52 PM, Mark Dickinson
The IBM format is particularly troublesome because it's base 16 instead of base 2 (so e.g. multiplying a float by 2 can lose bits), but it appears that recent IBM machines do both IBM format and IEEE format floating-point. I assume that the S-390 buildbots are using the IEEE side---is this true?
I don't know and suspect the only way to figure it out would be to write a test that would expose which is being used. It's using gcc, so we probably get whatever the compiler defaults to. Sometimes we have to specify flags for certain platforms. For example -mieee on the Alpha. It's fine to check in something so that you can get an answer on a buildbot. n
On Feb 1, 2008 6:31 PM, Neal Norwitz
On Feb 1, 2008 2:52 PM, Mark Dickinson
wrote: The IBM format is particularly troublesome because it's base 16 instead of base 2 (so e.g. multiplying a float by 2 can lose bits), but it appears that recent IBM machines do both IBM format and IEEE format floating-point. I assume that the S-390 buildbots are using the IEEE side---is this true?
I don't know and suspect the only way to figure it out would be to write a test that would expose which is being used. It's using gcc, so we probably get whatever the compiler defaults to. Sometimes we have to specify flags for certain platforms. For example -mieee on the Alpha.
It's fine to check in something so that you can get an answer on a buildbot.
Actually, an even better way to do this would be to craft a test case that exposes the assumptions you've found about the floating format. Then it'll be a valuable regression test even after someone fixes the bug. -- Namasté, Jeffrey Yasskin
participants (5)
-
"Martin v. Löwis"
-
Christian Heimes
-
Jeffrey Yasskin
-
Mark Dickinson
-
Neal Norwitz