lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adds longas, maximas and non-standard tweaks to MultiMeasureRest (is


From: k-ohara5a5a
Subject: Re: Adds longas, maximas and non-standard tweaks to MultiMeasureRest (issue4536068)
Date: Wed, 27 Jul 2011 04:13:48 +0000


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));
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).

http://codereview.appspot.com/4536068/diff/30001/lily/multi-measure-rest.cc#newcode132
lily/multi-measure-rest.cc:132: if (round && duration_log -
measure_duration_log < 0)
This, however, makes me pause, then wonder why you didn't use the same
idiom
 if (to_boolean(me->get_property ("round-to-longer-rest"))
   measure_duration_log = int (floor (duration_log));
 else
   measure_duration_log = int (ceil (duration_log));

http://codereview.appspot.com/4536068/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]