This documentation is archived and is not being maintained.

Math.rint Method

Visual Studio 2005

Returns a double number that represents the closest integer to a double parameter.

Package: java.lang

Assembly: vjslib (in vjslib.dll)


public static double rint(
    double a);

Parameters

a

A double expression.

A double number that represents the closest integer to the double parameter.

This example displays the closest integer value to 25.02.

// m-rint1.jsl
// Math.rint example
public class MyClass
{
    public static void main(String[] args)
    {
        System.out.println("The closest integer value = " +
                            Math.rint(25.02));
    }
}

/*
Output:
The closest integer value = 25.0
*/
Show: