Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-27 Thread Jasen Betts
On 2013-01-26, Gavan Schneider wrote: > On Saturday, January 26, 2013 at 08:13, Ian Pilcher wrote: > >>I need to cast a double precision into an integer, and I want to check >>that the value will actually fit (modulo rounding). >> >>Coming from a C/Java background, this seems like something that s

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Jasen Betts
On 2013-01-26, Ian Pilcher wrote: > I need to cast a double precision into an integer, and I want to check > that the value will actually fit (modulo rounding). > > Coming from a C/Java background, this seems like something that should > be utterly trivial. In my searching, however, I can't seem

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Adrian Klaver
On 01/26/2013 03:09 PM, Ian Pilcher wrote: 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 +21474836

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Gavan Schneider
On Saturday, January 26, 2013 at 08:13, Ian Pilcher wrote: I need to cast a double precision into an integer, and I want to check that the value will actually fit (modulo rounding). Coming from a C/Java background, this seems like something that should be utterly trivial. In my searching, howe

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Ian Pilcher
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 value

[GENERAL] Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Alexander Gataric
Just cast to integer. Decimal portion will be lost. Sent from my smartphone - Reply message - From: "Ian Pilcher" To: Subject: [GENERAL] Cast double precision to integer & check for overflow Date: Sat, Jan 26, 2013 3:13 pm I need to cast a double precision into an integ

[GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Ian Pilcher
I need to cast a double precision into an integer, and I want to check that the value will actually fit (modulo rounding). Coming from a C/Java background, this seems like something that should be utterly trivial. In my searching, however, I can't seem to find any SQL equivalent of INT_MAX, Integ