Re: BUG #12885: The result of casting a double to an integer depends on the database version
От | Tom Lane |
---|---|
Тема | Re: BUG #12885: The result of casting a double to an integer depends on the database version |
Дата | |
Msg-id | 13096.1427204266@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: BUG #12885: The result of casting a double to an integer depends on the database version (Michael Paquier <michael.paquier@gmail.com>) |
Ответы |
Re: BUG #12885: The result of casting a double to an integer
depends on the database version
|
Список | pgsql-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
В списке pgsql-bugs по дате отправления: