.\" Copyright 2001 Andries Brouwer . .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk .\" .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Japanese Version Copyright (c) 1997 Ueyama Rui .\" all rights reserved. .\" Translated Tue Feb 21 0:47:30 JST 1997 .\" by Ueyama Rui .\" Updated & Modified Fri Jul 6 20:35:28 JST 2001 .\" by Yuichi SATO .\" Updated & Modified Sun Jan 9 23:39:35 JST 2005 .\" by Yuichi SATO .\" Updated 2008-09-15, Akihiro MOTOKI .\" .\"WORD: mantissa 仮数 .\" .TH CEIL 3 2008-08-05 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O ceil, ceilf, ceill \- ceiling function: smallest integral value not .\"O less than argument ceil, ceilf, ceill \- 引き数を下回らない最小の整数値 .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "double ceil(double " x ); .br .BI "float ceilf(float " x ); .br .BI "long double ceill(long double " x ); .fi .sp .\"O Link with \fI\-lm\fP. \fI\-lm\fP でリンクする。 .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .ad l .BR ceilf (), .BR ceill (): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or .I cc\ -std=c99 .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O These functions return the smallest integral value that is not less than .\"O .IR x . これらの関数は \fIx\fP より小さくない最小の整数値を返す。 .\"O For example, .\"O .IR ceil(0.5) .\"O is 1.0, and .\"O .IR ceil(\-0.5) .\"O is 0.0. 例えば、 .I ceil(0.5) は 1.0 であり、 .I ceil(\-0.5) は 0.0 である。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O These functions return the ceiling of .\"O .IR x . これらの関数は .I x を下回らない整数値を返す。 .\"O If \fIx\fP is integral, +0, \-0, NaN, or infinite, .\"O \fIx\fP itself is returned. \fIx\fP が整数、+0、\-0、NaN、無限のいずれかの場合、 \fIx\fP そのものを返す。 .\"O .SH ERRORS .SH エラー .\"O No errors occur. エラーは発生しない。 .\"O POSIX.1-2001 documents a range error for overflows, but see NOTES. POSIX.1-2001 にはオーバーフローに対して範囲エラーが記載されている。 「注意」の節を参照。 .\"O .SH "CONFORMING TO" .SH 準拠 C99, POSIX.1-2001. .\"O The variant returning .\"O .I double .\"O also conforms to .\"O SVr4, 4.3BSD, C89. .I double 版の関数は SVr4, 4.3BSD, C89 にも準拠している。 .\"O .SH NOTES .SH 注意 .\"O SUSv2 and POSIX.1-2001 contain text about overflow (which might set .\"O .I errno .\"O to .\"O .BR ERANGE , .\"O or raise an .\"O .B FE_OVERFLOW .\"O exception). SUSv2 と POSIX.1-2001 にはオーバーフローに関する記述があり、 オーバーフローの際には .I errno を .B ERANGE に設定するか .B FE_OVERFLOW 例外を起こすとなっている。 .\"O In practice, the result cannot overflow on any current machine, .\"O so this error-handling stuff is just nonsense. 実際のところ、どの現行のマシンでも結果がオーバーフローを起こすことは ないので、このエラー処理は意味がない。 .\" The POSIX.1-2001 APPLICATION USAGE SECTION discusses this point. .\"O (More precisely, overflow can happen only when the maximum value .\"O of the exponent is smaller than the number of mantissa bits. .\"O For the IEEE-754 standard 32-bit and 64-bit floating-point numbers .\"O the maximum value of the exponent is 128 (respectively, 1024), .\"O and the number of mantissa bits is 24 (respectively, 53).) (より正確に言うと、オーバーフローは指数部の最大値が 仮数部を表すビットの数より小さい場合にしか起こらない。 IEEE-754 規格の 32 ビットと 64 ビットの浮動小数では、 指数部の最大値はそれぞれ 128 と 1024 であり、 仮数部のビット数はそれぞれ 24 と 53 である。) .\"O The integral value returned by these functions may be too large .\"O to store in an integer type .\"O .RI ( int , .\"O .IR long , .\"O etc.). .\"O To avoid an overflow, which will produce undefined results, .\"O an application should perform a range check on the returned value .\"O before assigning it to an integer type. これらの関数が返す整数値は整数型 .RI ( int , .I long など) に格納するには大き過ぎるかもしれない。 オーバーフローが起こった場合の結果は分からないので、 オーバーフローを避けるため、アプリケーションでは整数型に代入する前に 返された値の範囲確認を実行すべきである。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR floor (3), .BR lrint (3), .BR nearbyint (3), .BR rint (3), .BR round (3), .BR trunc (3)