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

Re: Arbitrary precision modulo operation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Paul Tillotson <pntil(at)shentel(dot)net>,pgsql-general(at)postgresql(dot)org
Subject: Re: Arbitrary precision modulo operation
Date: 2004-04-29 01:11:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Wed, Apr 28, 2004 at 14:02:57 -0700,
  Dann Corbit <DCorbit(at)connx(dot)com> wrote:
> > -----Original Message-----
> > From: Bruno Wolff III [mailto:bruno(at)wolff(dot)to] 
> > 
> > One option would be to define a separate division operator 
> > that always returns an integral value and that is truncated 
> > toward 0 and use that for the mod function. People might find 
> > this operator useful in itself.
> It will give some wrong results.  The result of mod should be the
> remainder after division, which is not always integral in the case of
> numeric fixed point or floating point.
> Consider the output of this program:

The remainder may not be integral but the quotient should be. However the
idea of getting the quotient, multiplying by the divisor and subtracting
from the dividend is not very good from an efficiancy point of view.

In response to

pgsql-general by date

Next:From: 帅猛Date: 2004-04-29 01:40:59
Subject: error about tcl/tk
Previous:From: Neil ConwayDate: 2004-04-28 23:29:09
Subject: Re: linked list rewrite

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