2 misc.cc -- implement various stuff
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
14 Return the 2-log, rounded down
34 return log (x
) /log (2.0);
39 comp (Real
const &a
, Real
const &b
)
45 quantise_iv (Array
<Real
> positions
, Real x
)
47 positions
.sort (comp
);
48 Real period
= positions
.top () - positions
[0];
50 int n
= int ((x
- positions
[0]) / period
);
51 Real frac
= (x
- positions
[0] ) - n
* period
;
59 Real px
= frac
+ positions
[0];
60 assert ( positions
[0] <= px
&& px
<= positions
.top ());
62 for (; i
< positions
.size () - 1; i
++)
64 if (positions
[i
] <= px
&& px
<= positions
[i
+1])
68 return Interval (positions
[i
] , positions
[i
+1]) + period
* n
;