Re: extend pgbench expressions with functions - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: extend pgbench expressions with functions
Date
Msg-id alpine.DEB.2.10.1601291514010.6449@sto
Whole thread Raw
In response to Re: extend pgbench expressions with functions  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: extend pgbench expressions with functions
List pgsql-hackers
>> Also, a comment is needed to explain why such a bizarre
>> condition is used/needed for just the INT64_MIN case.
>
> The last patch I sent has this bit:
> +              /*
> +               * Some machines throw a floating-point exception
> +               * for INT64_MIN % -1, the correct answer being
> +               * zero in any case.
> +               */
> How would you reformulate that à-la-Fabien?

This one about modulo is fine.

I was refering to this other one in the division case:

+            /* overflow check (needed for INT64_MIN) */
+            if (lval != 0 && (*retval < 0 == lval < 0))

Why not use "if (lval == INT64_MIN)" instead of this complicated 
condition? If it is really needed for some reason, I think that a comment 
could help.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Artur Zakirov
Date:
Subject: Re: Fuzzy substring searching with the pg_trgm extension
Next
From: Alexander Korotkov
Date:
Subject: Re: [PATCH] Refactoring of LWLock tranches