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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18390: exponentiation produces float datatype, but nth-root produces integer
Дата
Msg-id CAKFQuwYyJT+HFcOqGA5nawKA4yOnMdbGdqRkKbBLZ5KWFzcg7Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18390: exponentiation produces float datatype, but nth-root produces integer  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18390: exponentiation produces float datatype, but nth-root produces integer  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Tuesday, March 12, 2024, PG Bug reporting form <noreply@postgresql.org> wrote:
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:       

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)


1.000000000000…. Is a float.

The issue is you expect dividing two integers to produce a float but that isn’t how that works.  Dividing two integers produces an integer.  In this case zero, or .1 rounded down/truncated.

David J.
 

В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18391: not able to create a new cluster using init db on rocky linux.We are forced to download version 1 3
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: BUG #18391: not able to create a new cluster using init db on rocky linux.We are forced to download version 1 3