Re: bug in float8in()

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Richard Wang <ruc_wang(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bug in float8in()
Date: 2008-04-02 08:58:59
Message-ID: 47F34AD3.4030602@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If you look into documentation, the behavior of float/double is platform depend.
If you want to same result on any platform, use numeric instead.

Zdenek

Richard Wang napsal(a):
> I run the following sql statements in linux and get the results:
> postgres=# create table test_double(col1 float8);
> CREATE TABLE
> postgres=# insert into test_double values(1.7976931348623159E308);
> INSERT 0 1
> postgres=# select * from test_double;
> col1
> ----------
> Infinity
> (1 row)
>
> but in windows:
> postgres=# create table test_double(col1 float8);
> CREATE TABLE
> postgres=# insert into test_double values(1.7976931348623159E308);
> ERROR:
> "17976931348623159000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000000000000000000000000
> 00000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000"
> is out of range for type double precision
> postgres=# select * from test_double;
> col1
> ------
> (0 rows)
>
> This is a bug, the behavior in windows and linux is not the smae
>
> I check the code and find that float8in exists a bug:
> the strtod() function in linux dosen't set errno when dealing with
> 1.7976931348623159E308 but in windows it does
> How should we improve it?
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-04-02 09:25:19 Re: bug in float8in()
Previous Message Magnus Hagander 2008-04-02 08:10:59 Re: Several tags around PostgreSQL 7.1 broken