Dmitry Dolgov <9erthalion6@gmail.com> writes:
>> On Wed, Feb 08, 2023 at 10:03:01AM -0500, Tom Lane wrote:
>> I'd believe this argument more readily if the calculation weren't being
>> done in float arithmetic. Since it is, you're at the mercy of roundoff
>> error ... and that small negative delta could certainly pass for
>> roundoff error.
> Hmm...yeah, good point. In both the reproducer I've posted and the
> backtrace from the thread the delta is indeed rather small.
I bet also it only fails when dealing with IPv6 addresses.
With 32-bit IPv4 addresses, a float8 would have enough mantissa
bits that the calculation wouldn't become imprecise.
regards, tom lane