From: | Emre Hasegeli <emre(at)hasegeli(dot)com> |
---|---|
To: | nospam-pg-abuse(at)bloodgate(dot)com |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Langote <amitlangote09(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, keisuke kuroda <keisuke(dot)kuroda(dot)3862(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: In PG12, query with float calculations is slower than PG11 |
Date: | 2020-02-12 11:54:13 |
Message-ID: | CAE2gYzww_kdEFccj+8ZMVmMMQuhxhF=Q1J396p+GAJnK_Ebtrw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> But the comment does not explain that this test has to be in that
> order, or the compiler will for non-constant arguments evalute
> the (now) right-side first. E.g. if I understand this correctly:
>
> + if (!(zero_is_valid) && unlikely((val) == 0.0)
>
> would have the same problem of evaluating "zero_is_valid" (which
> might be an isinf(arg1) || isinf(arg2)) first and so be the same thing
> we try to avoid with the macro? Maybe adding this bit of info to the
> comment makes it clearer?
Added.
> Also, a few places use the macro as:
>
> + CHECKFLOATVAL(result, true, true);
>
> which evaluates to a complete NOP in both cases. IMHO this could be
> replaced with a comment like:
>
> + // No CHECKFLOATVAL() needed, as both inf and 0.0 are valid
>
> (or something along the lines of "no error can occur"), as otherwise
> CHECKFLOATVAL() implies to the casual reader that there are some checks
> done, while in reality no real checks are done at all (and hopefully
> the compiler optimizes everything away, which might not be true for
> debug builds).
I don't know why those trigonometric functions don't check for
overflow/underflow like all the rest of float.c. I'll submit another
patch to make them error when overflow/underflow.
The new version is attached.
Attachment | Content-Type | Size |
---|---|---|
0001-Bring-back-CHECKFLOATVAL-macro-v02.patch | text/x-patch | 25.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Emre Hasegeli | 2020-02-12 11:56:09 | Re: In PG12, query with float calculations is slower than PG11 |
Previous Message | Peter Eisentraut | 2020-02-12 10:54:10 | Re: Add PostgreSQL home page to --help output |