Skip site navigation (1) Skip section navigation (2)

Re: Arbitrary precision modulo operation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Chadwick Boggs <chadwickboggs(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Arbitrary precision modulo operation
Date: 2004-04-26 17:38:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Mon, Apr 26, 2004 at 10:18:52 -0400,
  Chadwick Boggs <chadwickboggs(at)yahoo(dot)com> 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 numerator 
> is in the format of a quoted string, which the mod function can't take.

I tried some large values and seem to be getting reasonable results.
I did get some negative remainders, but I didn't find anything in the
mod documentation on whether or not these were allowed. For small values
I always got positive remainders so it isn't consistantly return the
remainder closest to zero. My guess is that it has to do rounding when
dividing numerics.

In response to


pgsql-general by date

Next:From: Bruce MomjianDate: 2004-04-26 17:38:54
Subject: Re: shadowing (like IB/Firebird)
Previous:From: David GaramondDate: 2004-04-26 17:36:33
Subject: Re: shadowing (like IB/Firebird)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group