[Numpy-discussion] long double woes on win32
Charles R Harris
charlesr.harris at gmail.com
Sat Aug 16 15:07:44 EDT 2008
On Sat, Aug 16, 2008 at 11:39 AM, Charles R Harris <
charlesr.harris at gmail.com> wrote:
>
>
> On Sat, Aug 16, 2008 at 11:24 AM, David Cournapeau <cournape at gmail.com>wrote:
>
>> On Sat, Aug 16, 2008 at 12:15 PM, Charles R Harris
>> <charlesr.harris at gmail.com> wrote:
>> >
>> > I was just going to look at that; it's nice to have the ticket mailing
>> list
>> > working again. Is there an easy way to force the SIZEOF_LONG_DOUBLE to 8
>> so
>> > I can test this on linux?
>>
>> Changing this line in numpy¥core¥setup.py:
>>
>> - ('SIZEOF_LONG_DOUBLE', 'long double'),
>> + ('SIZEOF_LONG_DOUBLE', 'double'),
>>
>> is what I did to get the result on windows. But it only "works"
>> because I know the C runtime really has long double of 8 bytes. On
>> platforms where it is not true, it is likely to break things.
>>
>
> Hmm. ISTM that numpy should be set up so that the change works on all
> platforms. However, making it so might be something else.
>
Almost works, I get the same two failures as you plus a failure in
test_precisions_consistent.
ERROR: Test generic loops.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/numpy/core/tests/test_ufunc.py",
line 79, in test_generic_loops
assert_almost_equal(fone(x), fone_val, err_msg=msg)
File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 205,
in assert_almost_equal
return assert_array_almost_equal(actual, desired, decimal, err_msg)
File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 304,
in assert_array_almost_equal
header='Arrays are not almost equal')
File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 272,
in assert_array_compare
val = comparison(x[~xnanid], y[~ynanid])
IndexError: 0-d arrays can't be indexed
======================================================================
FAIL: test_large_types (test_scalarmath.TestPower)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/lib/python2.5/site-packages/numpy/core/tests/test_scalarmath.py", line
54, in test_large_types
assert_almost_equal(b, 6765201, err_msg=msg)
File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 207,
in assert_almost_equal
assert round(abs(desired - actual),decimal) == 0, msg
AssertionError:
Items are not equal: error with <type 'numpy.float64'>: got inf
ACTUAL: inf
DESIRED: 6765201
======================================================================
FAIL: test_umath.TestComplexFunctions.test_precisions_consistent
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/nose/case.py", line 203, in runTest
self.test(*self.arg)
File "/usr/lib/python2.5/site-packages/numpy/core/tests/test_umath.py",
line 206, in test_precisions_consistent
assert_almost_equal(fcl, fcd, decimal=15, err_msg='fch-fcl %s'%f)
File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 207,
in assert_almost_equal
assert round(abs(desired - actual),decimal) == 0, msg
AssertionError:
Items are not equal: fch-fcl <ufunc 'arcsin'>
ACTUAL: (0.66623943249251527+1.0612750619050355j)
DESIRED: (0.66623943249251527+1.0612750619050355j)
======================================================================
SKIP: test_umath.TestComplexFunctions.test_branch_cuts_failing
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/nose/case.py", line 203, in runTest
self.test(*self.arg)
File "/usr/lib/python2.5/site-packages/numpy/testing/decorators.py", line
93, in skipper
raise nose.SkipTest, 'This test is known to fail'
SkipTest: This test is known to fail
There is seems to be a problem in defining the functions called for the
different types.
In [3]: x = np.zeros(10, dtype=np.longdouble)[0::2]
In [4]: x.dtype.itemsize
Out[4]: 8
In [5]: x
Out[5]: array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=float64)
In [6]: np.exp(x)
Out[6]: array([NaN, NaN, NaN, NaN, NaN], dtype=float64)
In [7]: np.sin(x)
Out[7]: array([NaN, NaN, NaN, NaN, NaN], dtype=float64)
In [8]: x.dtype.char
Out[8]: 'g'
If I force the function to the double version this bit works fine. The odd
error message is a bug in numpy.testing where assert_array_compare fails for
arrays that contain only nan's. They all get masked out.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080816/b9368e03/attachment.html>
More information about the NumPy-Discussion
mailing list