[SciPy-User] numpy.longdouble and scipy status?

Iyán Méndez Veiga me at iyanmv.com
Wed Nov 13 08:00:23 EST 2019


Hi,

How is the current status of SciPy when using np.longdouble (np.float128)? I am 
doing some calculations where I would like to get a resolution of 1e-18. 
np.float128 in my computer would be ok for that, at least based on the output 
of numpy.finfo(numpy.float128).

However, some scipy functions always output numpy.float64 even though the input 
is numpy.float128. For example, try the following code:

import numpy as np
from scipy.linalg import expm

I = np.eye(3, dtype=np.float128)
A = expm(I)
print(A.dtype)

>> float128
>> float64

Is this behavious expected? I couldn't find anything on scipy docs, sorry if I 
overlooked.

Thanks,
Iyán




More information about the SciPy-User mailing list