Wednesday, November 1, 2017

Using RoundUp and RoundDown

Sometimes we would need to round a number, in this case you can use global method roundUp or rounDown.


static void roundExample()
{

    info(num2expstr(roundUp(6.5 ,1)));
  
}


The result is 7, 

This morning I was in trouble using this function... the result was 6 instead 7 such as if I would using roundDown,  some minutes later I notice I was tryng rounding a negative number LOL.



No comments:

Post a Comment