Re: Keep compiler silence (clang 10, implicit conversion from 'long' to 'double' )
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Yuya Watari <watari.yuya@gmail.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-11-06T03:21:40Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes: > On Wed, Nov 6, 2019 at 3:33 PM Yuya Watari <watari.yuya@gmail.com> wrote: >> However, this behavior depends on the platform architecture. As you >> have said, C language does not always follow IEEE-754. I think adding >> explicit checking of NaN is necessary. > I'm curious about this point. C may not require IEEE 754 (for > example, on current IBM mainframe and POWER hardware you can opt for > IBM hex floats, and on some IBM platforms that is the default, and the > C compiler isn't breaking any rules by doing that; the only other > floating point format I've heard of is VAX format, long gone, but > perhaps allowed by C). But PostgreSQL effectively requires IEEE 754 > since commit 02ddd499322ab6f2f0d58692955dc9633c2150fc, right? That commit presumes that floats follow the IEEE bitwise representation, I think; but it's a long way from there to assuming that float comparisons do something that is explicitly *not* promised by C99. The C spec goes no further than to state that comparisons on NaNs might raise an exception, and that's already bad enough. I believe that the assumption Yuya-san was making about "comparisons on NaNs return false" is only guaranteed by C99 if you use the new-in-C99 macros isless(x, y) and so on, not if you write x < y. There's a separate discussion to be had here about whether !isnan(x) && !isnan(y) && x < y is more or less efficient, or portable, than isless(x, y) but I'm not really in any hurry to start using the latter macros. regards, tom lane
Commits
-
Fix integer-overflow edge case detection in interval_mul and pgbench.
- 8d380864a523 9.4.25 landed
- 84780d468023 9.5.20 landed
- 15783d057543 9.6.16 landed
- 5f794f7572e1 10.11 landed
- b49b7f94489a 11.6 landed
- f6e72dc9cc8b 12.1 landed
- a7145f6bc8b7 13.0 landed
-
Change floating-point output format for improved performance.
- 02ddd499322a 12.0 cited