[Numpy-discussion] float128 / longdouble on PPC - is it broken?

Pauli Virtanen pav@iki...
Tue Oct 25 13:14:48 CDT 2011


25.10.2011 19:45, Matthew Brett kirjoitti:
[clip]
>> or, in case the platform doesn't have powl:
>>
>>         long double x;
>>         x = pow(2, 64);
>>         x -= 1;
>>         printf("%g %Lg\n", (double)x, x);
>
> Both the same as numpy:
>
> [mb312@jerry ~]$ gcc test.c
> test.c: In function 'main':
> test.c:5: warning: incompatible implicit declaration of built-in function 'powl'
> [mb312@jerry ~]$ ./a.out
> 1.84467e+19 3.68935e+19

This result may indicate that it's the *printing* of long doubles that's 
broken. Note how the value cast as double prints the correct result, 
whereas the %Lg format code gives something wrong.

Can you try to check this by doing something like:

- do some set of calculations using np.longdouble in Numpy
   (that requires the extra accuracy)

- at the end, cast the result back to double

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list