lilypond-devel
[Top][All Lists]
Advanced

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

Re: wrong position of rhythmic dots


From: Werner LEMBERG
Subject: Re: wrong position of rhythmic dots
Date: Mon, 22 Mar 2004 09:18:36 +0100 (CET)

> I wonder whether a patch similar to
> 
>   * lily/stem.cc (position_noteheads): rounding error robustness.
> 
> (from 2004-01-25) can fix the problem with incorrectly positioned
> rhythmic dots -- you told me that you can't repeat the problem.

It *is* a rounding issue!  In file dot-column.cc, function
Dot_column::do_shifts, there is the call

  int p = int (Staff_symbol_referencer::get_position (dp.dot_));

in line 274.  In file staff-symbol-referencer, function
Staff_symbol_referencer::get_position, there is 

  p += 2.0 * y / Staff_symbol::staff_space (st);

in line 74.

Checking with bc (setting the precision to 50 digits), there is the
following arithmetic operation for this line (the values have been
taken from a gdb session):

  2.0 * -0.94494078742115484 / 0.6299605249474366
  -2.99999999999999980951187376381606835665928357567868

Consequently, rounding with `int' gives -2 instead of the correct
result -3.

Doh, I don't want to check the lilypond source code for similar
rounding problems...


    Werner




reply via email to

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