-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Closed
Description
If you try to set a longdouble scalar with a string, it appears to go through Python's normal string-parsing and therefore gets converted to a C double rather than a long double:
In [19]: numpy.longdouble("1.12345678901234567890")
Out[19]: 1.1234567890123456912
Note the loss of those last couple digits.
In [20]: numpy.float("1.12345678901234567890")
Out[20]: 1.1234567890123457
In [21]: numpy.longdouble("1.12345678901234567890") - numpy.float("1.12345678901234567890")
Out[21]: 0.0
And so internally they are identical.
One solution to this is a special case for longdoubles and to use strtold() to do the conversion.
Cheers,
Scott
Reactions are currently unavailable