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

Re: BUG #5428: Discrepency in remainder on mod function.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Khee Chin" <kheechin(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5428: Discrepency in remainder on mod function.
Date: 2010-04-16 21:11:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
"Khee Chin" <kheechin(at)gmail(dot)com> writes:
> I'm not certain if this is a bug or an intended behavior.

> I noticed a discrepency in calculating the remainders across pgsql (PG),
> wolframalpha (W) and using Knuth's description of floored division

We follow whatever the C compiler's idea of modulo is.  This is somewhat
standardized, in fact, and I'm not excited about changing it.
Especially not by introducing roundoff-prone double arithmetic into what
had been an exact operation.

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Martin von GagernDate: 2010-04-16 21:43:40
Subject: Re: build error: strlcat/strlcpy used from heimdal
Previous:From: Khee ChinDate: 2010-04-16 21:05:03
Subject: BUG #5428: Discrepency in remainder on mod function.

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