|
From: | dak |
Subject: | Re: Standardizes use of empty extents in pure heights and skylines. (issue 7310075) |
Date: | Fri, 22 Feb 2013 15:11:17 +0000 |
On 2013/02/18 02:59:58, Keith wrote:
On Sun, 17 Feb 2013 02:07:19 -0800, mailto:address@hidden
<mailto:address@hidden>
wrote:
The classic error with floating point is to do math on the pair, something like (left . right) + shift/3.0 , where left==right, and then ask is_empty(). For some compiler options, the optimizer could keep left+shift/3 in register while right+shift/3 was stored to memory. If the register has finer precision than the memory format, and right+shift/3 was rounded down when stored, then is_empty() can return true.
This is sick enough to be right. One can explicitly cast to the used floating point type or assign to variables, however. I think that the standards allow this sort of "higher precision than warranted" operation only for intermediate results. With Scheme code, there is not much of a danger since the additions will pass through the same code path and thus get the same treatment for same values. https://codereview.appspot.com/7310075/
[Prev in Thread] | Current Thread | [Next in Thread] |