Open cheginit opened 3 years ago
Based on this bug report in numpy's repo, rounding a np.float16 could lead to inf. So instead, I propose to use a numpy function for converting a float to str. For example:
np.float16
inf
np.format_float_positional(np.float16(7.33), 4)
correctly return 7.33 but:
7.33
str(round(np.float16(7.33), 4))
returns inf.
Based on this bug report in numpy's repo, rounding a
np.float16
could lead toinf
. So instead, I propose to use a numpy function for converting a float to str. For example:correctly return
7.33
but:returns
inf
.