bool floatsEqual(double f1, double f2) { if (isDoubleNan(f1) || isDoubleNan(f2)) { return isDoubleNan(f1) && isDoubleNan(f2); } return (f2 - f1).abs() < epsilon; }