Re: Exponentiation confusion - Mailing list pgsql-general

From Erik Wienhold
Subject Re: Exponentiation confusion
Date
Msg-id 523542390.245047.1665691653665@office.mailbox.org
Whole thread Raw
In response to Re: Exponentiation confusion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> On 13/10/2022 19:16 CEST Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Erik Wienhold <ewie@ewie.name> writes:
> > On 13/10/2022 18:20 CEST Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> >> select power(10, -18::numeric);
> >> power
> >> --------------------
> >> 0.0000000000000000
> >> 
> >> Why is the cast throwing off the result?
> 
> > Calling power(numeric, numeric) is what I expect in that case instead of
> > downcasting the exponent argument to double precision, thus losing precision.
> 
> An inexact result isn't surprising, but it shouldn't be *that* inexact.

Ah, now I see the problem.  I saw a bunch of zeros but not that it's *all*
zeros.  Nevermind.

--
Erik



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pg_upgrade to 15 fails on Windows because of xml_is_well_formed()
Next
From: Andrus
Date:
Subject: How to return argument data type from sql function