Re: ERROR: value out of range: underflow in numeric log calculation
От | Tom Lane |
---|---|
Тема | Re: ERROR: value out of range: underflow in numeric log calculation |
Дата | |
Msg-id | 1526793.1700591650@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | ERROR: value out of range: underflow in numeric log calculation (Gallacher Neil <Neil.Gallacher@gstt.nhs.uk>) |
Список | pgsql-bugs |
Gallacher Neil <Neil.Gallacher@gstt.nhs.uk> writes: > When executing log calculations (example below): > SELECT 1.0 * exp(-1.0 *(ln(2) * (1695993520/86400.0)) / 0.04) AS result_test; > The following error occurs. > ERROR: value out of range: underflow Yup. > I can however understand that an individual might wish to know that the result of a calculation cannot be represented bythe system due to its small value however I don't believe it should be the default behaviour. You'd be in a minority on that opinion. In this case you could work around it by asking for the calculation to be done in numeric rather than float8: regression=# SELECT 1.0 * exp(-1.0 *(ln(2::numeric) * (1695993520/86400.0)) / 0.04) AS result_test; result_test --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (1 row) but I'm not sure how far that covers your real use-case. regards, tom lane
В списке pgsql-bugs по дате отправления: