floor.3m
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3M 代码 · 共 128 行
3M
128 行
.TH floor 3m RISC.SH Namefloor, ffloor, fabs, ceil, ceil, trunc, ftrunc, fmod, rint \- floor, absolute value, ceiling, truncation, floating point remainder and round-to-nearest functions.SH Syntax.nf.B #include <math.h>.PP.B double floor(\fIx\fP).B double \fIx\fP;.PP.B float ffloor(\fIx\fP).B float \fIx\fP;.PP.B double ceil(\fIx\fP).B double \fIx\fP;.PP.B float fceil(\fIx\fP).B float \fIx\fP;.PP.B double trunc(\fIx\fP).B double \fIx\fP;.PP.B float ftrunc(\fIx\fP).B float \fIx\fP;.PP.B double fabs(\fIx\fP).B double \fIx\fP;.PP.B double fmod (\fIx, y\fP).B double \fIx, y\fP;.PP.B double rint(\fIx\fP).B double \fIx\fP;.fi.SH Description.NXR "fabs subroutine".NXR "ceil subroutine".NXR "floor function" "returning integer".NXR "ceiling function" "returning integer".NXR "truncation".NXR "absolute value function".NXR "floating point remainder".NXR "round-to-nearest function"The .PN floorand .PN ffloorroutines return the largest integer which is not greater than xfor double and float data types, respectively..PPThe .PN ceiland.PN fceilroutines return the smallest integer which is not less than xfor double and float data types, respectively..PPThe.PN truncand.PN ftruncroutines return the integer (represented as a floating-point number)of x with the fractional bits truncatedfor double and float data types respectively..PPThe .PN fabsroutine returns the absolute value |\|x|..PPThe.PN fmodroutine returns the floating point remainder of the division of.I x\^by.IR y :zero if.I y\^is zero or if.I x/y\^would overflow;otherwise the number.I f\^with the same sign as.IR x ,such that.I "x = iy + f"for some integer.IR i ,and.RI | \|f "| < |" \|y |\|..PPThe.PN rintroutine returns the integer (represented as a double precision number)nearest x in the direction of the prevailing rounding mode..PPIn the default rounding mode, to nearest,.PN rint(x) is the integer nearest x with the additional stipulationthat if |rint(x)\-x|=1/2 then .PN rint(x) is even.Other rounding modes can make .PN rint act like .PN flooror.PN ceil ,or round towards zero..PPAnother way to obtain an integer near x is to declare (in C).RSdouble x;\0\0\0\0 int k;\0\0\0\0k\0=\0x;.REThe C compiler rounds x towards 0 to get the integer k.Also note that, if x is larger than k can accommodate, the value ofk and the presence or absence of an integer overflow are hard topredict..PPThe .PN fabs routine is in libc.a rather than libm.a..SH See Alsoabs(3),ieee(3m),math(3m)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?