Re: Comparing two double values method - Mailing list pgsql-hackers

From Matthias van de Meent
Subject Re: Comparing two double values method
Date
Msg-id CAEze2Wh6TTLxwHJd2Z_jTUuJcJOSw6YM7U-=5=81tMqtTRkL_w@mail.gmail.com
Whole thread Raw
In response to Comparing two double values method  (Bowen Shi <zxwsbg12138@gmail.com>)
List pgsql-hackers
On Tue, 10 Oct 2023 at 12:33, Bowen Shi <zxwsbg12138@gmail.com> wrote:
>
> Dears,
>
> I noticed that in the `check_GUC_init` function, there is a direct
> comparison using the != operator for two double values, which seems
> problematic.

I don't think I understand the problem. The code checks that the
dynamic initialization values are equal to the current value of the
GUC, or 0. Why would a "margin for error" of 1e-6 be of any use?
Why was the margin of 1e-6 chosen instead of one based on the exponent
of the GUC's current value (if any)?

In my view, this would break the code, not fix it, as it would
decrease the cases where we detect broken GUC registrations.

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_resetwal: Corrections around -c option
Next
From: Heikki Linnakangas
Date:
Subject: Re: Comparing two double values method