[Numpy-discussion] formatting issues, locale and co
Mon Jan 12 15:51:41 CST 2009
Wed, 31 Dec 2008 13:11:02 +0900, David Cournapeau wrote:
> Thank you for working on this, Pauli. The problem on windows may not be
> specific to windows: the difference really is whether the formatting is
> done by python or the C runtime. It just happens that on Linux and Mac
> OS X, the strings are the same - but it could be different on other OS.
> I have not looked into C99, whether this is standardized or not (the
> size of exponent is, but I don't know about nan and inf).
C99 appears to specify for *printf (case-insensitive)
nan, +nan, -nan, nan(WHATEVER), -nan(WHATEVER)
inf, infinity, +inf, +infinity, -inf, -infinity
The fromfile/fromstring code now in `fix_float_format` branch recognizes
all of these, independently of the platform.
There are also some roundtrip tests that check that this plays along as
expected with your new float formatting code.
> We should also change pretty print of arrays, I think - although it is a
> change and may break things. Since that's how python represents the
> numbers, I guess we will have to change at some point.
It'd be nice to make also this behave as the rest of the float
formatting. However, the current formatting of "Inf", "-Inf", "NaN" is OK
as far as C99 is concerned.
More information about the Numpy-discussion