Re: [GENERAL] Arbitrary precision modulo operation

2004-04-29 Thread Dann Corbit
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 28, 2004 9:14 PM > To: Dann Corbit > Cc: Bruno Wolff III; Paul Tillotson; [EMAIL PROTECTED] > Subject: Re: [GENERAL] Arbitrary precision modulo operation > > > &quo

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-27 Thread Paul Tillotson
Alvaro Herrera wrote: On Mon, Apr 26, 2004 at 12:48:45PM -0700, Dann Corbit wrote: Maple output: y := 123456789012345678901234567890 mod 123; y := 117 PgSQL 7.3.6 gives the right answer (117), 7.4 gets it wrong (-6). Most likely a bug was introduced when NUMERI

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-26 Thread Bruno Wolff III
On Mon, Apr 26, 2004 at 10:18:52 -0400, Chadwick Boggs <[EMAIL PROTECTED]> wrote: > I need to perform modulo operations on extremely large numbers. The % > operator is giving me number out of range errors and the mod(x, y) > function simply seems to return the wrong results. Also, my numerato

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-26 Thread Chadwick Boggs
Example of wrong results from modulo operation of arbitrary precision numbers: # select '123456789012345678901234567890'::numeric % 123; ?column? -- -6 (1 row) # select mod('123456789012345678901234567890'::numeric, 123); mod - -6 (1 row) The correct result (at least according

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-26 Thread Bruno Wolff III
On Mon, Apr 26, 2004 at 10:18:52 -0400, Chadwick Boggs <[EMAIL PROTECTED]> wrote: > I need to perform modulo operations on extremely large numbers. The % > operator is giving me number out of range errors and the mod(x, y) > function simply seems to return the wrong results. Also, my numerato

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-26 Thread Bruno Wolff III
On Mon, Apr 26, 2004 at 13:30:17 -0400, Chadwick Boggs <[EMAIL PROTECTED]> wrote: > Example of wrong results from modulo operation of arbitrary precision > numbers: > > # select '123456789012345678901234567890'::numeric % 123; > ?column? > -- > -6 > (1 row) > > # select mod('1234

Re: [GENERAL] Arbitrary precision modulo operation

2004-04-26 Thread Chadwick Boggs
Bruno, perhaps round is an issue. Thank you. Here is an example that should involve no rounding and indeed it works: Multiply the ten largest integer scale prime numbers: # select 2147483477::numeric * 2147483489::numeric * 2147483497::numeric * 2147483543::numeric * 2147483549::numeric * 2147