Re: Arbitrary precision modulo operation

Поиск
Список
Период
Сортировка
От Dann Corbit
Тема Re: Arbitrary precision modulo operation
Дата
Msg-id D90A5A6C612A39408103E6ECDD77B829408D69@voyager.corporate.connx.com
обсуждение исходный текст
Ответ на Arbitrary precision modulo operation  (Chadwick Boggs <chadwickboggs@yahoo.com>)
Ответы Re: Arbitrary precision modulo operation  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Список pgsql-general
Maple output:
y := 123456789012345678901234567890 mod 123;
                               y := 117

CONNX output (which uses qfloat by S. Moshier):
select mod(123456789012345678901234567890 , 123) {nopassthrough}
117

PariGP output:
? Mod(123456789012345678901234567890, 123)
%4 = Mod(117, 123)
?

> -----Original Message-----
> From: Bruno Wolff III [mailto:bruno@wolff.to]
> Sent: Monday, April 26, 2004 10:42 AM
> To: Chadwick Boggs
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Arbitrary precision modulo operation
>
>
> On Mon, Apr 26, 2004 at 13:30:17 -0400,
>   Chadwick Boggs <chadwickboggs@yahoo.com> wrote:
> > 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 to another, unnamed, RDBMS):
> >
> > > select '123456789012345678901234567890' % 123;
> > +----------------------------------------+
> > | '123456789012345678901234567890' % 123 |
> > +----------------------------------------+
> > |                                     58 |
> > +----------------------------------------+
> > 1 row in set (0.00 sec)
>
> I checked this with bc and I got -6 (and 117) as being
> correct. I would think the other database was wrong.
>
> It wouldn't happen to be MYSQL would it?
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>

В списке pgsql-general по дате отправления:

Предыдущее
От: Guy Fraser
Дата:
Сообщение: Re: 7.3.4 on Linux: UPDATE .. foo=foo+1 degrades massivly
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: 7.3.4 on Linux: UPDATE .. foo=foo+1 degrades massivly