Re: Cast double precision to integer & check for overflow

From: Ian Pilcher <arequipeno(at)gmail(dot)com>
To: Alexander Gataric <gataric(at)usa(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Cast double precision to integer & check for overflow
Date: 2013-01-26 23:09:47
Message-ID: 5104623B.40404@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/26/2013 05:06 PM, Alexander Gataric wrote:
> Just cast to integer. Decimal portion will be lost.

That part I've got. :-)

It's checking that the double precision value will actual fit within the
range of the integer type (-2147483648 to +2147483647). I could
certainly hard-code these values, but I'd like to use a more expressive
syntax, if it is available.

--
========================================================================
Ian Pilcher arequipeno(at)gmail(dot)com
Sometimes there's nothing left to do but crash and burn...or die trying.
========================================================================

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gavan Schneider 2013-01-26 23:35:18 Re: Cast double precision to integer & check for overflow
Previous Message Alexander Gataric 2013-01-26 23:06:42 Re: [GENERAL] Cast double precision to integer & check for overflow