pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: rschaaf@commoninf.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version
Date: Tue, 24 Mar 2015 09:37:46 -0400
Message-ID: <13096.1427204266@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqST=EUbvsx-mapemgA0jD9e9sgVezaV-UvtkeMfXyrigw@mail.gmail.com>
References: <20150320194337.2573.72944@wrigleys.postgresql.org>
	<32478.1427122083@sss.pgh.pa.us>
	<CAB7nPqQjby+5wAc-gcD77HZRA44CJpbxrD9t83s8C7cT7D5o9g@mail.gmail.com>
	<CAB7nPqRHostL3woG9uV5ZJDH5NwvOcNiU91LQ13W5emL4iRcaw@mail.gmail.com>
	<26862.1427166720@sss.pgh.pa.us>
	<CAB7nPqST=EUbvsx-mapemgA0jD9e9sgVezaV-UvtkeMfXyrigw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael Paquier <michael.paquier@gmail.com> writes:
> On Mon, Mar 23, 2015 at 8:12 PM, Tom Lane <tgl@sss.pgh.pa.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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (31+ messages)  latest in thread

Message-ID: <13096.1427204266@sss.pgh.pa.us>
Permalink:  ../13096.1427204266@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13096.1427204266@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, rschaaf@commoninf.com
  Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version
  In-Reply-To: <13096.1427204266@sss.pgh.pa.us>
  References: <20150320194337.2573.72944@wrigleys.postgresql.org> <32478.1427122083@sss.pgh.pa.us> <CAB7nPqQjby+5wAc-gcD77HZRA44CJpbxrD9t83s8C7cT7D5o9g@mail.gmail.com> <CAB7nPqRHostL3woG9uV5ZJDH5NwvOcNiU91LQ13W5emL4iRcaw@mail.gmail.com> <26862.1427166720@sss.pgh.pa.us> <CAB7nPqST=EUbvsx-mapemgA0jD9e9sgVezaV-UvtkeMfXyrigw@mail.gmail.com> <13096.1427204266@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox