ctypes' c_longdouble: underflow error (bug?)

Thomas Jollans thomas at jollans.com
Thu Jul 15 13:04:19 EDT 2010


On 07/15/2010 06:41 PM, kj wrote:
> In <mailman.733.1279124991.1673.python-list at python.org> Thomas Jollans <thomas at jollans.com> writes:
> 
>> http://docs.python.org/library/ctypes.html#fundamental-data-types
> 
>> c_longdouble maps to float
> 
> Thanks for pointing this out!
> ~K
> (Does it make *any difference at all* to use c_longdouble instead
> of c_double?  If not, I wonder what's the point of having c_longdouble
> at all.)

they're still different types (in C).

on my machine, a double is 64 bits wide, while a long double is 128 bits
wide. This means that a function that expects a long double argument
will expect 16 bytes, but ctypes will only pass 8 bytes if you tell it
to pass double. The same applies to return values.




More information about the Python-list mailing list