BUG #18390: exponentiation produces float datatype, but nth-root produces integer
| От | PG Bug reporting form |
|---|---|
| Тема | BUG #18390: exponentiation produces float datatype, but nth-root produces integer |
| Дата | |
| Msg-id | 18390-03499fe4f5a0ac71@postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #18390: exponentiation produces float datatype, but nth-root produces integer
|
| Список | 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 по дате отправления: