konrad.hinsen@laposte.net wrote:
On 09.04.2005, at 01:04, Scott Gilbert wrote:
I think something we've been assuming is that the array data is basically IEEE-754 compliant (maybe it needs to be byteswapped). If that's not true, then we're going to need some new typecodes. We're not supporting the ability to pass VAX floating point around (Are we????).
No, in moving from the struct modules character codes we are trying to do something more platform independent because it is very likely that different platforms will want to exchange binary data. IEEE-754 is a great standard to build an interface around. Data sharing was the whole reason the standard emerged and a lot of companies got on board.
This discussion has been coming up regularly for a few years. Until now the concensus has always been that Python should make no assumptions that go beyond what a C compiler can promise. Which means no assumptions about floating-point representation.
Of course the computing world is changing, and IEEE format may well be ubiquitous by now. Vaxes must be in the museum by now. But how about mainframes? IBM mainframes didn't use IEEE when I used them (last time 15 years ago), and they are still around, possibly compatible to their ancestors.
I found the following piece, written about 6 years ago interesting: http://www.research.ibm.com/journal/rd/435/schwarz.html Basically, it states that chips in newer IBM mainframes support the IEEE 754 standard.
Another detail to consider is that although most machines use the IEEE representation, hardly any respects the IEEE rules for floating point operations in all detail. In particular, trusting that Inf and NaN will be treated as IEEE postulates is a risky business.
But, this can be handled with platform-dependendent C-code when and if problems arise. -Travis