Floating point exceptions. - Mailing list pgsql-hackers

From Keith Parks
Subject Floating point exceptions.
Date
Msg-id 199801071611.QAA27856@mtcc.demon.co.uk
Whole thread Raw
List pgsql-hackers
Hi All,

I suspect this is an O/S or platform problem but can anyone offer any
suggestions as to how I might locate the cause.

DROP TABLE  FLOAT8_TBL;
DROP

CREATE TABLE FLOAT8_TBL(f1 float8);
CREATE

INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
INSERT 277993 1

SELECT '' AS bad, : (f.f1) from FLOAT8_TBL f;
ABORT:  floating point exception! The last floating point operation either
exceeded legal ranges or was a divide by zero


The ABORT message comes from tcop.c when we are hit by a FPE signal by
the operating system.

.....

Here's some additional tests that seem to show the threshold.

postgres=> CREATE TABLE FLOAT8_TBL(f1 float8);
CREATE
postgres=> INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-150');
INSERT 278057 1
postgres=>  SELECT '' AS bad, : (f.f1) from FLOAT8_TBL f;
bad|?column?
---+--------
   |       1
(1 row)

postgres=> INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-151');
INSERT 278058 1
postgres=> SELECT '' AS bad, : (f.f1) from FLOAT8_TBL f;
ABORT:  floating point exception! The last floating point operation either
exceeded legal ranges or was a divide by zero

Keith.


pgsql-hackers by date:

Previous
From: darrenk@insightdist.com (Darren King)
Date:
Subject: Linux/Alpha's s_lock.c and other ports...
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] database size