[Numpy-discussion] Preventing lossy cast for new float dtypes ?
cournape at gmail.com
Sat Aug 18 09:28:38 EDT 2012
I have started toying with implementing a quad precision dtype for
numpy on supported platforms, using the __float128 + quadmath lib from
gcc. I have noticed invalid (and unexpected) downcast to long double
in some cases, especially for ufuncs (e.g. when I don't define my own
ufunc for a given operation).
Looking down in numpy ufunc machinery, I can see that the issue is
coming from the assumption that long double is the highest precision
possible for a float type, and the only way I can 'fix' this is to
define kind to a value != 'f' in my dtype definition (in which case I
get an expected invalid cast exception). Is there a way to still avoid
those casts while keeping the 'f' kind ?
More information about the NumPy-Discussion