Exponentiation confusion - Mailing list pgsql-general

From Adrian Klaver
Subject Exponentiation confusion
Date
Msg-id 12a40226-70ac-3a3b-3d3a-fdaf9e32d312@aklaver.com
Whole thread Raw
Responses Re: Exponentiation confusion
Re: Exponentiation confusion
List pgsql-general
In trying to answer an SO question I ran across this:

Postgres version 14.5

select 10^(-1 * 18);
  ?column?
----------
     1e-18

select 10^(-1 * 18::numeric);
       ?column?
--------------------
  0.0000000000000000


Same for power:

select power(10, -18);
  power
-------
  1e-18
(1 row)

select power(10, -18::numeric);
        power
--------------------
  0.0000000000000000


Why is the cast throwing off the result?

-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Rita
Date:
Subject: Re: recovery.conf and archive files
Next
From: Erik Wienhold
Date:
Subject: Re: Exponentiation confusion