Folks,

only now was I able to do regression tests regarding my proposed fix(es) of the misplaced-note-head-bug (issue 5303):

The bug is caused by the integer-cast

lastpos = int (p);

in lily/stem.cc:629.

Replacing it by either
i) lastpos = p; // use float value
or
ii) lastpos = int (round (p)) // correctly round to integer

resolves the bug. Neither variant introduces regressions (differences only in in test-output-distance and rest-dot-position, the latter being, I think, unrelated - the seemingly random position changes of dots to multi-voice simultaneous rests).

Questions:

a) How to decide which fix is "better"? (My guess that using floats might pose the danger of rounding errors adding up until something bad happens - probably only for huge chords comprising hundreds of notes, but I'd tend to favor the solution with rounding.)

b) Would anybody be willing to shepherd a patch through the review process?

c) Does the situation warrant inclusion of a new regression test? (The example in the bug report on https://sourceforge.net/p/testlilyissues/issues/5303/ would be suitable I think.)

Best
Lukas


diff --git a/lily/stem.cc b/lily/stem.cc
index 37aa40c250..2a0f6fef84 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -626,7 +626,7 @@ Stem::calc_positioning_done (SCM smob)
       else
         parity = true;
 
-      lastpos = int (p);
+      lastpos = p;
     }
 
   return SCM_BOOL_T;
diff --git a/lily/stem.cc b/lily/stem.cc
index 37aa40c250..34bf557fca 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -626,7 +626,7 @@ Stem::calc_positioning_done (SCM smob)
       else
         parity = true;
 
-      lastpos = int (p);
+      lastpos = int (round (p));
     }
 
   return SCM_BOOL_T;
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to