diff --git a/Userland/Libraries/LibSQL/Value.cpp b/Userland/Libraries/LibSQL/Value.cpp index 80ddeea19e7603..0e1146e10e2d5d 100644 --- a/Userland/Libraries/LibSQL/Value.cpp +++ b/Userland/Libraries/LibSQL/Value.cpp @@ -773,8 +773,11 @@ int FloatImpl::compare(Value const& other) const if (!casted.has_value()) { return 1; } + auto diff = value() - casted.value(); - return (diff < NumericLimits::epsilon()) ? 0 : ((diff > 0) ? 1 : -1); + if (fabs(diff) < NumericLimits::epsilon()) + return 0; + return diff < 0 ? -1 : 1; } String BooleanImpl::to_string() const