Re: numeric and float comparison oddities
От | Kevin Grittner |
---|---|
Тема | Re: numeric and float comparison oddities |
Дата | |
Msg-id | 1406904656.34054.YahooMailNeo@web122305.mail.ne1.yahoo.com обсуждение исходный текст |
Ответ на | numeric and float comparison oddities (Jeff Davis <pgsql@j-davis.com>) |
Ответы |
Re: numeric and float comparison oddities
|
Список | pgsql-hackers |
Jeff Davis <pgsql@j-davis.com> wrote: > I saw some strange results: > > postgres=# select '1.1'::numeric = '1.1'::float8; > ?column? > ---------- > t > (1 row) > > postgres=# select '1.1'::numeric = '1.1'::float4; > ?column? > ---------- > f > (1 row) The part I find strange is that the first one evaluates to true, since numeric can exactly represent 1.1 and float8 cannot. It also seems inconsistent with this: test=# set extra_float_digits = 3; SET test=# select '1.1'::float4; float4 ------------ 1.10000002 (1 row) test=# select '1.1'::float8; float8 --------------------- 1.10000000000000009 (1 row) -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: