Обсуждение: Floating point exceptions.

Поиск
Список
Период
Сортировка

Floating point exceptions.

От
Keith Parks
Дата:
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.