On 2013/02/18 02:59:58, Keith wrote:
On Sun, 17 Feb 2013 02:07:19 -0800, mailto:m...@mikesolomon.org
<mailto:m...@mikesolomon.org>
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/ _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel