Re: Interval aggregate regression failure (expected seems - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Interval aggregate regression failure (expected seems
Date
Msg-id 87irv4e002.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Interval aggregate regression failure (expected seems  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Interval aggregate regression failure (expected seems  (Gregory Maxwell <gmaxwell@gmail.com>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I think we can still file this as a compiler bug, because I'm pretty sure
> the C spec does not allow rearrangement of floating-point calculations ...

It may have more to do with whether the floating point value can stay in a
floating point register long enough to complete the calculation. 

IIRC, floating point registers are actually longer than a double so if the
entire calculation is done in registers and then the result rounded off to
store in memory it may get the right answer. Whereas if it loses the extra
bits on the intermediate values (the infinite repeating fractions) that might
be where you get the imprecise results.

It makes some sense that -mcpu and -march give the compiler enough information
to keep the intermediate results in registers more effectively.

-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: REL8_1_STABLE and HEAD
Next
From: Greg Stark
Date:
Subject: Re: Interval aggregate regression failure (expected seems