Re: BUG #12885: The result of casting a double to an integer depends on the database version

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: rschaaf(at)commoninf(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version
Date: 2015-03-24 13:37:46
Message-ID: 13096.1427204266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> On Mon, Mar 23, 2015 at 8:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Look for something about setting the IEEE float rounding mode. "Round to
>> nearest even" is standard in most places, but it would not astonish me
>> to hear that Microsoft got that wrong.

> I have done more testing (done only 9.3 with MinGW and MSVC before)
> and the failure can be reproduced on master and REL9_4_STABLE as well
> because visibly with MSVC 2010 the version of rint used is the one of
> src/port, which is defined like that:
> return (x >= 0.0) ? floor(x + 0.5) : ceil(x - 0.5);
> For example by passing 2.5, we would get 3.0, and not 2.0 (nearest
> even number). So isn't the problem here?

Hmm ... why are we using src/port's version? rint() has been required
by POSIX for decades, surely MSVC has got it?

(IOW, I'd rather fix this by removing src/port's version than by
trying to upgrade it to full IEEE spec.)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2015-03-24 23:53:00 Re: ALTER TABLE documentation or parser bug
Previous Message Michael Paquier 2015-03-24 11:05:49 Re: pg_upgrade failure on Windows Server