Javatpoint Logo
Javatpoint Logo

C++ Math rint()

The function rounds off the given value to the nearest integer using current rounding mode. The current rounding mode is determined by fesetround().

For example:


Suppose a number 'x'. Syntax would be:

Note: The return_type can be float, double or long double.


x: The value that can be either float or double.

Return value

It returns the rounded value of x.

Example 1

Let's see a simple example.


Value of x is :9.9
Rounding to nearest,value is :10
Rounding to upward,value is :10
Rounding to downward,value is :9

Next TopicC++ Math Functions

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA