Re: float4 problem

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: float4 problem
Дата
Msg-id m3d6p0jkou.fsf@varsoon.wireboard.com
обсуждение исходный текст
Ответ на float4 problem  (Oleg Bartunov <oleg@sai.msu.su>)
Ответы Re: float4 problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Oleg Bartunov <oleg@sai.msu.su> writes:

> May be I miss something, but seems there is a problem with float4
> in 7.2.3 and 7.3RC1 (6.53 works fine):
> 
> test=# create table t ( a float4);
> CREATE TABLE
> test=# insert into t values (0.1);
> INSERT 32789 1
> test=# select * from t where a=0.1;
>  a
> ---
> (0 rows)


I'm guessing this is because 0.1 is not directly representable as a
binary floating point number, and literal floating constants are
float8 not float4, and 0.1::float4 != 0.1::float8.  Same problem that
causes queries on int2 fields not to use an index unless you cast the
constants in the query...

-Doug


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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: float4 problem
Следующее
От: "Ken Hirsch"
Дата:
Сообщение: Re: Geometry test on NetBSD (was Re: RC1?)