Bug with the innerRound method with negative Decimal
Closed this issue · 1 comments
codisart commented
I was testing negative values for tangent and cotangente when i found several rounding errors.
I followed the process and I think there is a mistake with the rounding of negative numbers.
Exemple : I use the division of 0.984376 by -0.176077. the result is -5.59059956723478932512..
but with the Decimal::div(), it gives
for the scale of 3 : -5.589
for the scale of 4 : -5.5904
for the scale of 5 : -5.59058
for the scale of 6 : -5.590598
I think i have pinpointed the probleme in Decimal::innerRound().
When a number is negative and if the next digit after the scale is greater than 5, the one should be substracted and not added.