BUG #18390: exponentiation produces float datatype, but nth-root produces integer

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: robb(at)helical(dot)com
Subject: BUG #18390: exponentiation produces float datatype, but nth-root produces integer
Date: 2024-03-13 02:57:57
Message-ID: 18390-03499fe4f5a0ac71@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18390
Logged by: Robb Allan
Email address: robb(at)helical(dot)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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-03-13 03:24:01 RE: Re:RE: Re:RE: Re:RE: Re:BUG #18369: logical decoding core on AssertTXNLsnOrder()
Previous Message Noah Misch 2024-03-12 22:08:07 Re: FSM Corruption (was: Could not read block at end of the relation)