BUG #18390: exponentiation produces float datatype, but nth-root produces integer - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18390: exponentiation produces float datatype, but nth-root produces integer
Date
Msg-id 18390-03499fe4f5a0ac71@postgresql.org
Whole thread Raw
Responses Re: BUG #18390: exponentiation produces float datatype, but nth-root produces integer
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18390
Logged by:          Robb Allan
Email address:      robb@helical.com
PostgreSQL version: 15.5
Operating system:   Mac OS Sonoma 14.3.1 (23D60)
Description:

An exponentiation from a float produces a floating point result:

funds=# select (1.1^10);
      ?column?      
--------------------
 2.5937424601000000
(1 row)

However, an nth-root calculation from that float result does NOT produce a
new float result:

funds=# select (2.5937424601000000^(1/10));
      ?column?      
--------------------
 1.0000000000000000
(1 row)


Only when the root factors are floats does the result coerce to a float:

funds=# select (2.5937424601000000^(1.0/10));
        ?column?        
------------------------
 1.10000000000000000000
(1 row)

funds=# select (2.5937424601000000^(1/10.0));
        ?column?        
------------------------
 1.10000000000000000000
(1 row)


pgsql-bugs by date:

Previous
From: Noah Misch
Date:
Subject: Re: FSM Corruption (was: Could not read block at end of the relation)
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Re:RE: Re:RE: Re:RE: Re:BUG #18369: logical decoding core on AssertTXNLsnOrder()