Hacker News new | ask | show | jobs
by reacweb 55 days ago
I suggest

if a.abs()+b.abs() >= (a-b).abs() * 2f64.powi(48)

It remains accurate for small and for big numbers. 48 is slightly less than 52.

1 comments

that will return incorrect answers if a=b and 2a=Inf