Round a Number Up or Down
If you want all fractions to round up (e.g. 2.1 -> 3.0, 2.5 -> 3.0) then use Math.Ceil. (See Round a number up.)
If you want all fractions to round down (e.g. 2.1 -> 2.0, 2.5 -> 2.0) then use Math.Floor. (See Round a number down.)
If you want anything equal to or above ".5" to round up, and anything below ".5" to round down (e.g. 2.1 -> 2.0, 2.5 -> 3.0), use the following action:
If you want all fractions to round up (e.g. 2.1 -> 3.0, 2.5 -> 3.0) then use Math.Ceil. (See Round a number up.)
If you want all fractions to round down (e.g. 2.1 -> 2.0, 2.5 -> 2.0) then use Math.Floor. (See Round a number down.)
If you want anything equal to or above ".5" to round up, and anything below ".5" to round down (e.g. 2.1 -> 2.0, 2.5 -> 3.0), use the following action:
Kod:
n = 2.5;
rounded = Math.Round(n);