Re: Comparing two double values method

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Bowen Shi <zxwsbg12138(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Comparing two double values method
Date: 2023-10-10 10:55:15
Message-ID: CAEze2Wh6TTLxwHJd2Z_jTUuJcJOSw6YM7U-=5=81tMqtTRkL_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 10 Oct 2023 at 12:33, Bowen Shi <zxwsbg12138(at)gmail(dot)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)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-10-10 10:56:47 Re: Comparing two double values method
Previous Message Alvaro Herrera 2023-10-10 10:53:58 Re: pg_resetwal: Corrections around -c option