[Numpy-discussion] formatting issues, locale and co

Pauli Virtanen pav@iki...
Tue Dec 30 20:28:29 CST 2008

Mon, 29 Dec 2008 13:38:12 +0900, David Cournapeau wrote:
> I put my yesterday work in the fix_float_format branch:
>  - it fixes the locale issue
>  - it fixes the long double issue on windows. 
>  - it also fixes some tests (we were not testing single precision
>    formatting but twice double precision instead 
>  - the single precision test fails on the trunk BTW).
>  - it handles inf and nan more consistently across platforms (e.g.
>    str(np.log(0)) will be '-inf' on all platforms; on windows, it used
>    to be '-1.#INF' 
>  - I was afraid it would broke converting back the
>    string to float, but it is broken anyway before my change, e.g. 
>    float('-1.#INF') does not work on windows).

I did some work on the fix_float_format branch from the opposite 
direction, making fromfile and fromstring properly locale-independent. 
(cf. #884)

Works currently on POSIX systems, but some tests fail on Windows because 
float('inf') does not work [neither does float('-1.#INF')...]. (cf. #510) 
A bit more work must be done on NumPyOS_ascii_strtod to make inf/nan work 
as intended. Also, roundtrip tests for repr would be nice to add, if they 
aren't there yet, and possibly for str <-> fromstring roundtrip, too. 
I'll be almost offline for 1.5 weeks starting now, so if you want to 
finish this, go ahead.

Pauli Virtanen

More information about the Numpy-discussion mailing list