rint()

Returns the double (floating-point) value that is closest in value to the value and is equal to a mathematical integer.

Syntax

rint()

Usage

If two double values that are mathematical integers are equally close, the result is the integer value that is even.

Special cases:
  • If the value is already equal to a mathematical integer, then the result is the same as the value.
  • If the value is NaN or an infinity or positive zero or negative zero, then the result is the same as the value.