Share via


Math.round

Class Overview | Class Members | This Package | All Packages

Syntax 1

public static int round( float a )

Parameters
  • a
    a float value.
Returns

the value of the argument rounded to the nearest int value.

Description

Returns the closest int to the argument.

If the argument is negative infinity or any value less than or equal to the value of Integer.MIN_VALUE, the result is equal to the value of Integer.MIN_VALUE.

If the argument is positive infinity or any value greater than or equal to the value of Integer.MAX_VALUE, the result is equal to the value of Integer.MAX_VALUE.

See Also

MAX_VALUE, MIN_VALUE

Syntax 2

public static long round( double a )

Parameters
  • a
    a double value.
Returns

the value of the argument rounded to the nearest long value.

Description

Returns the closest long to the argument.

If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE.

If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.

See Also

MAX_VALUE, MIN_VALUE