I know, after reading the https://stackoverflow.com/a/166168/ which will be examined on your number, decide if the midpoint is an even or odd number, and then will return an even number. The example number was 2.5, which was rounded to 3. I tried my own little experiments to find out what would happen, but I still need to find some specifications about this, or even if it is agreed between browsers.
Here is an example JavaScript snippet using jQuery to render:
$(document).ready(function() { $("#answer").html(showRounding()); }); function showRounding() { var answer = Math.round(2.5); return answer; }
This returns a '3'.
I would like to know the following: how close is rounding in JavaScript to the C # equivalent? The reason I do this is because I would like to use a JavaScript method that uses Math.Round and rewrite the same method in C # and would like to know that after rounding the number I get the same results.
javascript c # rounding
Chris
source share