ERROR: value out of range: underflow in numeric log calculation - Mailing list pgsql-bugs

From Gallacher Neil
Subject ERROR: value out of range: underflow in numeric log calculation
Date
Msg-id CWLP265MB5906D3545378C97AADA62BE3DEBBA@CWLP265MB5906.GBRP265.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: ERROR: value out of range: underflow in numeric log calculation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

Hi,

 

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

 

I can find no way around this other than to wrap the calculation in a function with

 

exception when numeric_value_out_of_range then return 0;

 

However performance is impacted when performing calculations on multiple rows with a function call.

 

I can however understand that an individual might wish to know that the result of a calculation cannot be represented by the system due to its small value however I don’t believe it should be the default behaviour.

 

Thank you,

 

Neil Gallacher

 

Analyst/Programmer

 

 

 

 

 

 

 

 

 


The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.
 
Unless otherwise specified, the opinions expressed herein do not necessarily represent those of Guy's and St Thomas' NHS Foundation Trust or any of its subsidiaries.
 
The information contained in this e-mail may be subject to public disclosure under the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this e-mail and any replies cannot be guaranteed.
 
Any review, retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies.
 
We make every effort to keep our network free from viruses. However, it is your responsibility to ensure that this e-mail and any attachments are free of viruses as we can take no responsibility for any computer virus which might be transferred by way of this e-mail.

pgsql-bugs by date:

Previous
From: Filip Sedlák
Date:
Subject: Re: B-tree Index corruption
Next
From: vignesh C
Date:
Subject: Re: BUG #18203: Logical Replication initial sync failure