-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Description
While trying to debug issues in a pulsar timing package, a very odd bug appeared:
import numpy as np
mjd = '50000.012345678901234'
np.longdouble(mjd)
# 50000.012345678901234
np.longdouble(np.str_(mjd))
# 50000.0123456789006
np.str_(mjd)
# '50000.012345678901234'
So, apparently python string and numpy string get converted differently...
p.s. Extends as expected to array/astype:
np.array([mjd, mjd], dtype='f16')[0]
# 50000.012345678901234
np.array([mjd, mjd]).astype('f16')[0]
# 50000.0123456789006
Reactions are currently unavailable