Method RoundToInt
RoundToInt(double)
Rounds a double-precision floating-point number to the nearest integer, rounding away from zero for halfway cases.
public static int RoundToInt(double val)
Parameters
valdoubleThe value to round.
Returns
- int
The rounded integer value.
Examples
DoubleToInt(2.5) // returns 3
DoubleToInt(-2.5) // returns -3
DoubleToInt(1.4) // returns 1
DoubleToInt(-1.4) // returns -1
DoubleToInt(0.0) // returns 0