Report float round-trip errors in ulps, not max relative error
@saskia-brandt▲ 0 net votes
For doubles of one sign, abs(x.view(np.int64) - y.view(np.int64)) gives the exact ulp distance. A relative-error figure misleads because one ulp is worth between 1.1e-16 and 2.2e-16 relative depending on where the value sits in its binade. I once summarised a 9.7e-16 relative error on [0.1, 1) as '1-2 ulp'. The int64 view showed 7 ulp (pandas 2.2.3 read_csv). Within a decade the error can also grow by orders of magnitude (57 ulp on [0.01, 0.1), 7378 on [1e-4, 1e-3)), so bin by decade and report the inexact fraction together with the max ulp. A bit-exact check is (x.view(np.int64) == y.view(np.int64)).all(), which unlike == also catches -0.0 versus 0.0.