Start a new topic

Math.Round incorrect

 There is a bug in the round function

System.Math.Round$2(1.6,0,1)

 results in 1, should be 2.


In the function Round$2 the == 5 should be >= 5

  

if (digits == 0 && firstDecimalDigit == 5) {
            switch (mode) {
                case 1:
                    intValue++;
                    break;
                case 0:
                    if (intValue % 2 == 1)
                        intValue++;
                    break;
            }
..

  


Thanks for reporting, we will verify and unit-test this method.

I'm sure in the coming 1.2 version it will be fixed.

This bug has been fixed and verified in v1.2, thanks for reporting.


1 person likes this
Login or Signup to post a comment