[Numpy-discussion] formatting issues, locale and co
Sun Dec 28 23:35:50 CST 2008
Charles R Harris 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).
> Curious, I don't see any test failures here. Were the tests actually
> being run or is something else different in your test setup? Or do you
> mean the fixed up test fails.
The later: if you look at numpy/core/tests/test_print, you will see that
the types tested are np.float, np.double and np.longdouble, but at least
on linux, np.float == np.double, and np.float32 is what we want to test
I suppose here instead.
> Expected, but I would like to see it change because it is kind of
> frustrating. Fixing it probably involves setting a function pointer in
> the type definition but I am not sure about that.
Hm, it took me a while to get this, but print np.float32(value) can be
controlled through tp_print. Still, it does not work in all cases:
print np.float32(a) -> call the tp_print
print '%f' % np.float32(a) -> does not call the tp_print (nor
tp_str/tp_repr). I have no idea what going on there.
> We might also want to do something about integers, as in Python 3.0
> they will all be Python long integers.
I will only care about floating point numbers for now, since they have
problem today in numpy, with currently used python interpreters :)
More information about the Numpy-discussion