diff options
Diffstat (limited to 'man3/lround.3')
-rw-r--r-- | man3/lround.3 | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/man3/lround.3 b/man3/lround.3 new file mode 100644 index 0000000..e48f71a --- /dev/null +++ b/man3/lround.3 @@ -0,0 +1,114 @@ +'\" t +.\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>. +.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk +.\" <mtk.manpages@gmail.com> +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH lround 3 2023-07-20 "Linux man-pages 6.05.01" +.SH NAME +lround, lroundf, lroundl, llround, llroundf, llroundl \- round to +nearest integer +.SH LIBRARY +Math library +.RI ( libm ", " \-lm ) +.SH SYNOPSIS +.nf +.B #include <math.h> +.PP +.BI "long lround(double " x ); +.BI "long lroundf(float " x ); +.BI "long lroundl(long double " x ); +.PP +.BI "long long llround(double " x ); +.BI "long long llroundf(float " x ); +.BI "long long llroundl(long double " x ); +.fi +.PP +.RS -4 +Feature Test Macro Requirements for glibc (see +.BR feature_test_macros (7)): +.RE +.PP +All functions shown above: +.nf + _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L +.fi +.SH DESCRIPTION +These functions round their argument to the nearest integer value, +rounding halfway cases away from zero, +regardless of the current rounding direction (see +.BR fenv (3)). +.PP +Note that unlike the +.BR round (3) +and +.BR ceil (3), +functions, the return type of these functions differs from +that of their arguments. +.SH RETURN VALUE +These functions return the rounded integer value. +.PP +If +.I x +is a NaN or an infinity, +or the rounded value is too large to be stored in a +.I long +.RI ( "long long" +in the case of the +.B ll* +functions), +then a domain error occurs, and the return value is unspecified. +.\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1) +.SH ERRORS +See +.BR math_error (7) +for information on how to determine whether an error has occurred +when calling these functions. +.PP +The following errors can occur: +.TP +Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large +.\" .I errno +.\" is set to +.\" .BR EDOM . +An invalid floating-point exception +.RB ( FE_INVALID ) +is raised. +.PP +These functions do not set +.IR errno . +.\" FIXME . Is it intentional that these functions do not set errno? +.\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6797 +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR lround (), +.BR lroundf (), +.BR lroundl (), +.BR llround (), +.BR llroundf (), +.BR llroundl () +T} Thread safety MT-Safe +.TE +.sp 1 +.SH STANDARDS +C11, POSIX.1-2008. +.SH HISTORY +glibc 2.1. +C99, POSIX.1-2001. +.SH SEE ALSO +.BR ceil (3), +.BR floor (3), +.BR lrint (3), +.BR nearbyint (3), +.BR rint (3), +.BR round (3) |