BUG #4657: mod() makes a mistake in calculation in v8.3

From: "Fujii Masao" <masao(dot)fujii(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4657: mod() makes a mistake in calculation in v8.3
Date: 2009-02-16 07:10:48
Message-ID: 200902160710.n1G7Am3n082862@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4657
Logged by: Fujii Masao
Email address: masao(dot)fujii(at)gmail(dot)com
PostgreSQL version: 8.3.6 on x86_64
Operating system: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Description: mod() makes a mistake in calculation in v8.3
Details:

In 8.3, I found the bug of 'mod' function to make an error in calculation
when the second argument is defined as 'numeric'.

postgres=# SELECT version();
version
----------------------------------------------------------------------------
-------------------------------
PostgreSQL 8.3.6 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20070626 (Red Hat 4.1.2-14)
(1 row)

postgres=# SELECT mod(70000, 35);
mod
-----
0
(1 row)

postgres=# SELECT mod(70000.0, 35.0);
mod
------
35.0
(1 row)

On the other hand, in HEAD, mod() seems to work fine.

postgres=# SELECT version();
version
----------------------------------------------------------------------------
------------------------------------------
PostgreSQL 8.4devel on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20070626 (Red Hat 4.1.2-14), 64-bit
(1 row)

postgres=# SELECT mod(70000, 35);
mod
-----
0
(1 row)

postgres=# SELECT mod(70000.0, 35.0);
mod
-----
0.0
(1 row)

I guess the following change fixed the bug which I found. Right?
Why don't we backport this?
http://archives.postgresql.org/pgsql-committers/2008-04/msg00030.php

Regards,

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-02-16 09:37:27 Re: BUG #4656: Indexes not used when comparing nextval() and currval() to integers
Previous Message Mathias Seiler 2009-02-16 02:18:20 BUG #4656: Indexes not used when comparing nextval() and currval() to integers