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

Matthew Brett matthew.brett at gmail.com
Tue Oct 25 13:44:33 EDT 2011


Hi,

On Tue, Oct 25, 2011 at 7:31 AM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>
> On Mon, Oct 24, 2011 at 10:59 PM, Matthew Brett <matthew.brett at gmail.com>
> wrote:
>>
>> Hi,
>>
>> I just ran into this on a PPC machine:
>>
>> In [1]: import numpy as np
>>
>> In [2]: np.__version__
>> Out[2]: '2.0.0.dev-4daf949'
>>
>> In [3]: res = np.longdouble(2)**64
>>
>> In [4]: res
>> Out[4]: 18446744073709551616.0
>>
>> In [5]: 2**64
>> Out[5]: 18446744073709551616L
>>
>> In [6]: res-1
>> Out[6]: 36893488147419103231.0
>>
>> Same for numpy 1.4.1.
>>
>> I don't have a SPARC to test on but I believe it's the same double-double
>> type?
>>
>
> The PPC uses two doubles to represent long doubles, the SPARC uses software
> emulation of ieee quad precision for long doubles, very different.

Yes, thanks - I read more after my post.  I guess from this:

http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.genprogc/doc/genprogc/128bit_long_double_floating-point_datatype.htm

that AIX does use double-double.

> The
> subtraction of 1 working like multiplication by two is strange, perhaps the
> one is getting subtracted from the exponent somehow? It would be interesting
> to see if the same problem happens in pure c.
>
> As a work around, can I ask what you are trying to do with the long doubles?

I was trying to use them as an intermediate format for high-precision
floating point calculations, before converting to integers.

Best,

Matthew



More information about the NumPy-Discussion mailing list