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)
When I looked into it, I saw that the numeric is being cast to a float8,
making the first statement
Jeff Davis pg...@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
Kevin Grittner kgri...@ymail.com writes:
Jeff Davis pg...@j-davis.com wrote:
I saw some strange results:
The part I find strange is that the first one evaluates to true,
since numeric can exactly represent 1.1 and float8 cannot.
The reason is that the numeric input is converted to float8 for
Tom Lane t...@sss.pgh.pa.us wrote:
Kevin Grittner kgri...@ymail.com writes:
Jeff Davis pg...@j-davis.com wrote:
I saw some strange results:
The part I find strange is that the first one evaluates to true,
since numeric can exactly represent 1.1 and float8 cannot.
The reason is that the
Kevin Grittner kgri...@ymail.com writes:
It would be more consistent, ISTM, to cast
float8 to float4 when those are compared, and to cast numeric to
whichever type is on the other side of the comparison operator.
I would vote against that on the grounds of greatly increased risk
of overflow
Tom Lane t...@sss.pgh.pa.us wrote:
Kevin Grittner kgri...@ymail.com writes:
It would be more consistent, ISTM, to cast
float8 to float4 when those are compared, and to cast numeric to
whichever type is on the other side of the comparison operator.
I would vote against that on the grounds of