Cannot use 128-bit float in Python on 64-bit architecture

I checked pointer size in my python terminal (in Enthought Canopy IDE) via

import ctypes print (ctypes.sizeof(ctypes.c_voidp) * 8) 

I have 64 bit architecture and work with numpy.float64 . But I can not use np.float128 ?

 np.array([1,1,1],dtype=np.float128) 

or

 np.float128(1) 

leads to:

 AttributeError: 'module' object has no attribute 'float128' 

I am running the following version:

 sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0) 
+6
python numpy 128bit
Apr 23 '15 at 10:32
source share
1 answer

Update. From the comments, even 128-bit navigation in a 64-bit system seems pointless.

I use anaconda on a Ubuntu 14.04 64-bit system with sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0)

and 128 bit floats work fine:

 import numpy a = numpy.float128(3) 

This may be a distribution problem. Try:

EDIT: Update comments:

Not my top-down, but this post doesn’t actually answer "why not np.float128 is on my machine" is an implied question. that this is platform-specific: float128 exists on some platforms, but not on those platforms where it exists, almost certainly just an 80-bit x87 extended accuracy type, complemented by 128 bits. - Mark Dickinson

0
Apr 23 '15 at 11:04
source share



All Articles