RoundRealToNearestInteger (double inputRealNumber);
Rounds its floating-point argument and returns the result as a long integer. A value with a fractional part of exactly 0.5 is rounded to the nearest even number.
long n;
n = round (1.2); /* result: 1L */
n = round (1.8); /* result: 2L */
n = round (1.5); /* result: 2L */
n = round (0.5); /* result: 0L */
n = round (-1.2); /* result: -1L */
n = round (-1.8); /* result: -2L */
n = round (-1.5); /* result: -2L */
n = round (-0.5); /* result: 0L */
Input | ||
Name | Type | Description |
inputRealNumber | double-precision | Real number to round. |
Name | Type | Description |
nearestInteger | long | The integer nearest to the value of the real number. |