rint man page on 4.4BSD

 Man page or keyword search:   man All Sections 1 - General Commands 2 - System Calls 3 - Subroutines, Functions 4 - Special Files 5 - File Formats 6 - Games and Screensavers 7 - Macros and Conventions 8 - Maintenence Commands 9 - Kernel Interface New Commands Server 4.4BSD AIX Alpinelinux Archlinux Aros BSDOS BSDi Bifrost CentOS Cygwin Darwin Debian DigitalUNIX DragonFly ElementaryOS Fedora FreeBSD Gentoo GhostBSD HP-UX Haiku Hurd IRIX Inferno JazzOS Kali Knoppix LinuxMint MacOSX Mageia Mandriva Manjaro Minix MirBSD NeXTSTEP NetBSD OPENSTEP OSF1 OpenBSD OpenDarwin OpenIndiana OpenMandriva OpenServer OpenSuSE OpenVMS Oracle PC-BSD Peanut Pidora Plan9 QNX Raspbian RedHat Scientific Slackware SmartOS Solaris SuSE SunOS Syllable Tru64 UNIXv7 Ubuntu Ultrix UnixWare Xenix YellowDog aLinux   1065 pages apropos Keyword Search (all sections) Output format html ascii pdf view pdf save postscript
[printable version]

```RINT(3)			 BSD Library Functions Manual		       RINT(3)

NAME
rint — round-to-closest integer functions

SYNOPSIS
#include <math.h>

double
rint(double x);

DESCRIPTION
The rint() function finds the integer (represented as a double precision
number) nearest to x in the direction of the prevailing rounding mode.

NOTES
On a VAX, rint(x) is equivalent to adding half to the magnitude and then
rounding towards zero.

In the default rounding mode, to nearest, on a machine that conforms to
IEEE 754, rint(x) is the integer nearest x with the additional stipula‐
tion that if |rint(x)-x|=1/2 then rint(x) is even.	 Other rounding modes
can make rint() act like floor(), or like ceil(), or round towards zero.

Another way to obtain an integer near x is to declare (in C)

double x;	 int k;	   k = x;

Most C compilers round x towards 0 to get the integer k, but some do oth‐
erwise.  If in doubt, use floor(), ceil(), or rint() first, whichever you
intend.  Also note that, if x is larger than k can accommodate, the value
of k and the presence or absence of an integer overflow are hard to pre‐
dict.

abs(3), fabs(3), ceil(3), floor(3), ieee(3), math(3)

HISTORY
A rint() function appeared in Version 6 AT&T UNIX.

BSD			       December 11, 1993			   BSD
```
[top]

List of man pages available for 4.4BSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.