opening 1.3 score with nested tuplets and saving with with 2.x causes corruption

• Jan 24, 2017 - 12:05
Reported version
2.1
Type
Functional
Severity
S3 - Major
Status
closed
Project

See https://musescore.org/en/node/165411, the 1.3 score from there demonstrates the Problem, ot opens with 2.x (2.0.2, 2.0.3, nightly 2.1) without reporting any issue, but after having been saved with 2.x it does report a corruption on the last measure:
Measure 84 Staff 8 incomplete. Expected: 7/4; Found: 564/320
The affected measure contains a pretty convoluted (set of nested) tuplet(s), this most probably is a major part of the problem, something about rounding seems to go horribly wrong, 564/320 is 7.04/4...

So it seems that 2.x introduces a corruption.

Opening the 1.3 score with current master causes a crash, not sure whether this is due to the same Problem or entire unrelated


Comments

i told in my thread that i got similar issue in different environment (which was written in qt/c++ too however)
that was my project in kTurtle ide when i got rounding error. i introduced workaround for my script and it worsened clarity of my code but made my function to work.
my script was calculating integer part of floating point number after decimal shift.
i do not know if my experience is usable to you.. i can post my script here if you would be intersting.
there was wrong decimal/hexadecimal conversion implemented in my ide. rounding operator was been bugged. it got small values (lesser than one) after subtracting 'true constant integer' from a result of rounding floating point number.
but it would be needed to convert my script to .txt format if you wish to read that. my ide gives .html as only alternative to its native .turtle file format
(oh i could try to paste in a comment directly in .html but my script is quiet big)

edit: i was not sure about what caused that bug in rounding operator.. i readed about decimal/hexadecimal conversion error in a book by rob krten me guesses. that was about programming for qnx neutrino rtos. from their documentation but maybe was some other book

i would post my kTurtle script here to examplify my own problem with rounding function.
you may mute my post if that would be required by your forum`s posting rules.
script is very big and i do not know how to use html directly --that is plain text without syntax highlighting.
i learned c++ a little but cannot program with that yet --me uses kTurtle for my projects (runic text editor etc).

#_shiftToInteger_--by_irulan_
#it_was_a_stack_mistake_again
#_--i_did_introduced_$trick_
#_--irulan_
#
#_required_parameters:_precision_digits_limits_
#_outputs:_value_and_digits_
#
learn shiftToInteger $variable, $precision, $value, $degree, $runOnce, $int, $parameter, $exception {
$test = 0
if not $runOnce {
$runOnce = true
if $variable > 9999999 { exit }
$approximation = round $variable
if $approximation > $variable {
$test = $approximation - $variable
$flag = false
$int = $approximation - 1
}
else {
if $approximation < $variable {
$test = $variable - $approximation
$flag = true
$int = $approximation
}
}
#_a_protection_
if $int > 9 {
if $variable >= 999999 {
print $int
print " ____________$int_--an_overflow"
}
else {
print $int
print " ____________$int_--non-normalized_notation"
}
exit
}
#
if $test {
pencolor 255, 255, 0
forward 10
pencolor 0, 0, 127
print $test
print " _________________$test_--first_enter"
forward 10
pencolor 0, 0, 0
#_branch_one_(maybe_a_$warning_is_needed)_
if $variable >= 1 {
if $flag { $parameter = 10 * $test }
else { $parameter = ($parameter + 1 - $approximation) * 10 }
# $warning = true
}
#_branch_two_
else {
if $variable < 1 {
if $flag { $parameter = 10 * $test }
else { $parameter = ($parameter + 1 - $approximation) * 10 }
}
}
#_branch_three_ $degree < and$localPrecision else {
# if $flag { $parameter = 10 * $test }
#$parameter = ($parameter + 1 - $approximation) * 10
$parameterM = round $parameter
$trick = ($parameterM * 100000) - ($parameter * 100000)
forward 12
print $trick
print " __--____$trick"
forward 12
if not ($trick < 1) {
$trick = $trick * 100000
forward 12
print $trick
print " __--____$trick+"
forward 12
if ($trick >= 0) {
$parameterM = $parameterM - 1
forward 12
print " target"
print $parameterM
}
}
$degree = $degree + 1
$value = $value * 10 + $parameterM
$check = $int + $value / (10 ^ $degree)
if $check == $variable {
$exception = true
pencolor 64, 0, 0
print "point one"
pencolor 255, 255, 0
forward 10
pencolor 0, 0, 0
}
if not $exception {
if $degree == $precision {#_blue_alert_--irulan
pencolor 0, 0, 64
forward 12
print " *____$precision____*"
forward 12
$output = $value
$globalInt = $int
return $degree
}
$degree = shiftToInteger $variable, $precision, $value, $degree, $runOnce, $int, $parameter, false
return $degree
}
}
}
else {
$approximation = round $parameter
if $approximation > $parameter {
$test = $approximation - $parameter
$flag = false
}
else {
if $approximation < $parameter {
$test = $parameter - $approximation
$flag = true
}
}
#
if $test {
pencolor 255, 255, 0
forward 10
pencolor 0, 0, 127
print $test
print " _________________$test_--new_enter"
forward 10
pencolor 0, 0, 0
forward 12
print " __________init__$parameter"
print $parameter
forward 12
#_branch_one_(maybe_a_$warning_is_needed)_
if $parameter >= 1 {
if $flag { $parameter = 10 * $test }
else { $parameter = ($parameter + 1 - $approximation) * 10 }
print "**"
}
#_branch_two_
else {
if $parameter < 1 {
if $flag { $parameter = 10 * $test }
else { $parameter = ($parameter + 1 - $approximation) * 10 }
print "##"
}
}
$parameterM = round $parameter
forward 12
print $parameterM
forward 12
print " __________**__$parameter"
print $parameter
$trick = ($parameterM * 100000) - ($parameter * 100000)
forward 12
print $trick
print " __--____$trick"
forward 12
if not ($trick < 1) {
$trick = $trick * 100000
forward 12
print $trick
print " __--____$trick+"
forward 12
if ($trick >= 0) {
$parameterM = $parameterM - 1
forward 12
print " target"
print $parameterM
}
}
$degree = $degree + 1
$value = $value * 10 + $parameterM
forward 12
print " $parameterM "
print $parameterM
forward 12
print " $value"
print $value
forward 12
$check = $int + $value / (10 ^ $degree)
forward 12
print $check
print " ___-_-________$check"
forward 12
if $check == $variable {
$exception = true
pencolor 0, 64, 0
print "point two"
pencolor 255, 255, 0
forward 10
pencolor 0, 0, 0
}
if not $exception {
if $degree == $precision {#_blue_alert_--irulan
pencolor 0, 0, 64
forward 12
print " *____$precision____*"
forward 12
$output = $value
$globalInt = $int
return $degree
}
$degree = shiftToInteger $variable, $precision, $value, $degree, $runOnce, $int, $parameter, false
return $degree
}
}
}
$output = $value
$globalInt = $int
return $degree
}
#(and_limits_--are_not_implemented)
learn container $variable, $output {
$int = 0
$precision = 6
$value = 0
$degree = 0
$runOnce = false
$digits = shiftToInteger $variable, $precision, $value, $degree, $runOnce, $int, 0, false
# $output = $value #_must_be_assigned_in_a_function_body_--irulan_
#without_$output
# print $value
# forward 10
return $digits
}
#
reset
canvassize 400, 980
go 15, 950
message "* maximal value for normal notation is 999999 *"
message "* examples: 9.41432e+10 is 3 in 24th power and .666667 is 2/3 *"
$variable = ask "' input positive number (6 digits after dot is maximal precision) '"
$globalInt = 0
$output = 0
print container $variable, $output
print " _________________$digits_--a_degree_of_a_shift"
penup
forward 15
print $output
print " _________________$output_--fractal_part"
forward 15
print $globalInt
print " _________________$int_--integer_part"
forward 15
if not $output {
pencolor 255, 0, 0
print "* it is either a null or an integer number *"
forward 15
pencolor 0, 255, 0
print $variable
pencolor 0, 0, 255
print " ______________$variable_--an_inputted_value"
}
forward 20
#
#