From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dave Page <dpage(at)pgadmin(dot)org> |
Subject: | Re: Numeric x^y for negative x |
Date: | 2021-09-13 18:29:13 |
Message-ID: | CAEZATCXARqKNk57P+00v9RnpOhL13s04RmBHNrY9sTRv_Vev1g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 13 Sept 2021 at 17:51, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> I came here just to opine that there should be a comment about there not
> being a clamp to the maximum scale. For example, log_var says "Set the
> scales .. so that they each have more digits ..." which seems clear
> enough; I think the new comment is a bit on the short side.
>
OK, that's a fair point. Updated version attached.
> I couldn't get bc (version 1.07.1) to output the result; it says
>
> Runtime warning (func=(main), adr=47): non-zero scale in exponent
> Runtime error (func=(main), adr=47): exponent too large in raise
>
Ah yes, bc's "^" operator is a bit limited. It doesn't support
fractional powers for example, and evidently doesn't like powers that
large. I'm so used to not using it that I didn't notice - I always
just use exp() and ln() in bc to compute powers:
scale=2000
e(l(1 - 1.500012345678*10^-1000) * 1.45*10^1003) * 10^1000
Regards,
Dean
Attachment | Content-Type | Size |
---|---|---|
fix-numeric-power-precision-loss-v2.patch | text/x-patch | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bossart, Nathan | 2021-09-13 18:49:16 | Re: Estimating HugePages Requirements? |
Previous Message | Tom Lane | 2021-09-13 18:28:55 | Re: PG Docs - CREATE SUBSCRIPTION option list order |