[Numpy-discussion] portable doctests despite floating points numbers
Sébastien Barthélemy
barthelemy@crans....
Fri Oct 15 03:12:28 CDT 2010
Hello all,
I use doctest for examples and tests in a program which relies heavily on numpy.
As floating point calculations differs slightly across computers
(32/64 bits), I have troubles
writing portable doctests.
The doctest documentation [1] advises to use numbers in the form
int/2**n. This is quite restrictive.
Using numpy.set_printoptions(suppress=True) also helps, but I still
have problems with numbers around 0. On some platform a result prints
as 0., on others as -0.
Is there a workaround?
[1] http://docs.python.org/library/doctest.html#warnings
More information about the NumPy-Discussion
mailing list