Re: numeric and float comparison oddities

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: numeric and float comparison oddities
Date: 2014-08-01 19:27:10
Message-ID: 1771.1406921230@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin Grittner <kgrittn(at)ymail(dot)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 failure. Admittedly, numeric->float8 can also fail,
but float4 only goes to 1e37 or thereabouts.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2014-08-01 19:39:20 Re: numeric and float comparison oddities
Previous Message Kevin Grittner 2014-08-01 19:17:30 Re: numeric and float comparison oddities