http://codereview.appspot.com/4536068/diff/30001/lily/multi-measure-rest.cc File lily/multi-measure-rest.cc (right):
http://codereview.appspot.com/4536068/diff/30001/lily/multi-measure-rest.cc#newcode131 lily/multi-measure-rest.cc:131: int measure_duration_log = int (ceil (duration_log)); On 2011/07/27 04:13:48, Keith wrote:
To me, having done numerical work, the chain of functions you use,
int( ceil(
-log2(x))), is easily recognizable as "find the smallest n so that 1 /
2^n <=
x".
While log2 is inexact, the results when x is a power of 2 are exact (IEEE-compliant floating-point represents integers and integer powers
of 2
exactly) so reliably 3/4 and 2/4 both come out 1 (half/minim rest).
log2 is a transcedental operation, it is not guaranteed to be exact. logb would be (it just returns the exponent from the floating point representation). Anyway, it seems like log2 is not universally available, so we should avoid it. The same is likely true for logb. http://codereview.appspot.com/4536068/diff/37002/lily/multi-measure-rest.cc File lily/multi-measure-rest.cc (right): http://codereview.appspot.com/4536068/diff/37002/lily/multi-measure-rest.cc#newcode241 lily/multi-measure-rest.cc:241: length = (2 << -i) / 2; The division by 2 changes the result. Not that I understand too well what it is supposed to be doing. http://codereview.appspot.com/4536068/ _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel