Re: float8 strtod weirdness

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: float8 strtod weirdness
Дата
Msg-id 20090107145744.GC1475@fetter.org
обсуждение исходный текст
Ответ на float8 strtod weirdness  ("Nikhil Sontakke" <nikhil.sontakke@enterprisedb.com>)
Список pgsql-hackers
On Wed, Jan 07, 2009 at 08:12:44PM +0530, Nikhil Sontakke wrote:
> Hi,
> 
> Consider the following with latest CVS sources:
> 
> postgres=# create table temp(val float4);
> CREATE TABLE
> postgres=# insert into temp values (415.1);
> INSERT 0 1
> postgres=# select * from temp where val = 415.1;
>  val
> -----
> (0 rows)
> 
> !?

No "!?" at all.  The "=" operation on floats has never been one to
count on.  If you need "=" not to give "surprising" results, you need
to use some other data type such as numeric.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Nikhil Sontakke"
Дата:
Сообщение: float8 strtod weirdness
Следующее
От: Tom Lane
Дата:
Сообщение: Re: float8 strtod weirdness