Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error
Date
Msg-id 15115.1543017152@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom>      if (unlikely(num < (float4) INT_MIN || num >= (float4) INT_MAX || isnan(num)))

>     if (num < (float4)INT_MIN || num >= -(float4)INT_MIN || ...

Meh.  Seems to me that's relying on pretty much the same assumptions
and throwing in an extra dollop of obscurantism on top.

            regards, tom lane


pgsql-bugs by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error
Next
From: Tom Lane
Date:
Subject: Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error