In C++, the llrint() function is defined in the <cmath> or <math.h> header file and is used to round a floating-point value according to the current rounding mode and return the result as a long long int. The rounding mode can be controlled using the fesetround() function from the <cfenv> header file.
The llrint() function supports float, double, and long double values. It is commonly used where rounded long long integer values are required.
It has the following syntax.
x: The value which is to be rounded.
It returns the rounded value of 'x' and the return type of the value is long long int.
Here, we are going to discuss several examples to demonstrate the List lrint() Function Function.
This example demonstrates how the llrint() function rounds a floating-point value upward using the upward rounding mode.
Output:
Value of x is :5.3 Rounded value of x is :6
This example demonstrates how the llrint() function rounds a floating-point value downward using the downward rounding mode.
Output:
Value of x is :7.9 Rounded value of x is :7
This example demonstrates how the llrint() function behaves when the input value is already an integer. In this case, the same value is returned as a long long integer.
Output:
Value of x is : 30 Rounded value of x is : 30
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India