Thread: Float Infinity

Float Infinity

From
Kaloyan Iliev
Date:
Hi All,

I just want to ask shouldn't substraction from infinity returns infinity
in float just like in timestamp?

This is for float:

a=# SELECT version();
                                            version
------------------------------------------------------------------------------------------------
 PostgreSQL 8.1.5 on i386-portbld-freebsd6.2, compiled by GCC cc (GCC)
3.4.6 [FreeBSD] 20060305
(1 row)

a=# SELECT 'Infinity'::float;
  float8
----------
 Infinity
(1 row)

a=# SELECT 'Infinity'::float-10;
ERROR:  type "double precision" value out of range: overflow
a=# SELECT 'Infinity'::float+10;
ERROR:  type "double precision" value out of range: overflow
a=# SELECT 'Infinity'::float-10::float;
ERROR:  type "double precision" value out of range: overflow
a=# SELECT 'Infinity'::float+10::float;
ERROR:  type "double precision" value out of range: overflow

And this is for timestamp:

a=# SELECT 'Infinity'::timestamp;
 timestamp
-----------
 infinity
(1 row)

a=# SELECT 'Infinity'::timestamp-'10 days'::interval;;
 ?column?
----------
 infinity
(1 row)

Regards,
   Kaloyan