Unit test error with numpy rc3

Ted Horst ted.horst at earthlink.net
Thu Oct 26 20:55:36 EDT 2006


On Oct 26, 2006, at 12:26, Travis Oliphant wrote:

> Charles R Harris wrote:
>>
>>
>> On 10/26/06, *Travis Oliphant* <oliphant.travis at ieee.org
>> <mailto:oliphant.travis at ieee.org>> wrote:
>>
>>     Ted Horst wrote:
>>> On Mac OS X tiger (10.4) ppc, long double has increased
>>     precision but
>>> the same range as double (it really is 128 bits not 80, btw), so
>>> e**1000 is inf, so this is not really an error.
>>>
>>>
>>
>>     Thanks for the clarification.   Long-double is not standard  
>> across
>>     platforms with different platforms choosing to do different  
>> things
>>     with
>>     the extra bytes.    This helps explain one more platform.
>>
>>> I'm not sure what is the right thing to do in the test, check for
>>> overflow?  Also, finfo has never worked properly for this type.
>>>
>>     In machar.py  is the code that runs to detect all of the
>>     parameters.  I
>>     think the code should be moved to C as detecting precision on a
>>     long-double takes too long.
>>
>>     The overflow check is a good idea. The test should probably  
>> check for
>>     overflow and not try to run if it's detected.
>>
>>
>> How to check overflow? According to the documentation the flag is not
>> set by the hardware. And the precision is variable! Somewhere in the
>> neighborhood of 31 decimal digits, more or less, depending. So I  
>> think
>> it is hard to figure out what to do here.
>
> Let's drop the test.    Long-double is available but is not consistent
> across platforms and NumPy has done nothing to try and make it so.
> Thus, let's just let the user beware.
>
> -Travis

Yeah, that seem like the thing to do.

Just for completeness:

 >>> N.seterr(all = 'raise')
 >>> fa = N.array([1e308], dtype=N.float)
 >>> lfa = N.array([1e308], dtype=N.longfloat)
 >>> fa + fa
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
FloatingPointError: overflow encountered in add
 >>> lfa + lfa
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
FloatingPointError: overflow encountered in add
 >>> N.exp(fa)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
FloatingPointError: overflow encountered in exp
 >>> N.exp(lfa)
array([inf], dtype=float128)

Ted


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the NumPy-Discussion mailing list