From: Janek Warchoł Date: Fri, 22 Mar 2013 07:09:05 +0000 (+0100) Subject: Adds an explanatory comment to skyline.cc. X-Git-Tag: release/2.17.15-1~17^2~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d275ca42d6f29579aa3abe7ef1978e3916f5cdb2;p=lilypond.git Adds an explanatory comment to skyline.cc. Author: Janek Warchoł --- diff --git a/lily/skyline.cc b/lily/skyline.cc index 9908c611d5..3f52d82e90 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -54,6 +54,25 @@ a DOWN skyline with an UP skyline, we need to flip the DOWN skyline first. This means that the merging routine doesn't need to be aware of direction, but the distance routine does. + + Be careful about numerical accuracy. When dealing with extremely small values, + computation errors may arise due to the use of floating point arithmetic. + For example, if left and right have equal values to start with, in C++ + they may not receive the same value after + + left = left*factor + offset; + right = right*factor + offset; + + Which is very unfortunate. Maybe using GCC compiler options to disallow + extended precision for intermediate results and/or the choice to store + intermediates with less than full precision would retain some kind of + deterministic behavior that way. + + Anyway, it seems that accepting extremely narrow building in skylines + doesn't cause accuracy problems to us, so we allow arbitrarily small buildings. + However, as Keith pointed out, problems may appear if more than one operation + is done before storing the result, and/or there are different code paths + for doing the operations to the different ends of an interval. */ static void