lrint() in C++
The lrint() function rounds the fractional value given in the argument to an integral value using the current rounding mode. This function is defined in <cmath> library. The current mode is determined by the function fesetround().
Note:This function returns the final value in long int.
Syntax
lrint(double a); lrint(float a);
Parameter
- The lrint() function takes double or float or integer value as an argument.
Return Value
- The lrint() function rounds the fractional value given in the argument to an integral value using the current rounding mode and returns the value in a long int.
Here, the current mode is determined by the function fesetround(). By default, the rounding direction is set to ‘to-nearest’. It can be changed using fesetround().
Error
- It is mandatory to give an argument otherwise it will give an error no matching function for call to ‘lrint()’.
Contact Us