.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk .\" .\" Distributed under GPL .\" Based on glibc infopages .\" .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI all rights reserved. .\" Translated Mon Jan 27 2003 by Akihiro MOTOKI .\" Updated 2008-09-18, Akihiro MOTOKI .\" .\"WORD: mantissa 仮数部 .\"WORD: normalized 正規化された .\"WORD: subnormal 非正規化の .\" .TH NEXTAFTER 3 2010-09-20 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .\"O nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl \- .\"O floating-point number manipulation .SH 名前 nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl \- 浮動小数点数の操作 .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "double nextafter(double " x ", double " y ); .br .BI "float nextafterf(float " x ", float " y ); .br .BI "long double nextafterl(long double " x ", long double " y ); .sp .BI "double nexttoward(double " x ", long double " y ); .br .BI "float nexttowardf(float " x ", long double " y ); .br .BI "long double nexttowardl(long double " x ", long double " y ); .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 nextafter (): .RS 4 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L; .br or .I cc\ -std=c99 .RE .br .BR nextafterf (), .BR nextafterl (): .RS 4 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L; .br or .I cc\ -std=c99 .RE .br .BR nexttoward (), .BR nexttowardf (), .BR nexttowardl (): .RS 4 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L; .br or .I cc\ -std=c99 .RE .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR nextafter () .\"O functions return the next representable floating-point value following .\"O .I x .\"O in the direction of .\"O .IR y . .\"O If .\"O .I y .\"O is less than .\"O .IR x , .\"O these functions will return the largest representable number less than .\"O .IR x . .BR nextafter () 関数群は、\fIy\fP に向かう方向で \fIx\fP のすぐ次の浮動小数点数表現を返す。 .I y が .I x より小さい場合、 .I x より小さい最大の浮動小数点表現の値を返す。 .\"O If \fIx\fP equals \fIy\fP, the functions return \fIy\fP. \fIx\fP が \fIy\fP と等しい場合、\fIy\fP が返される。 .\"O The .\"O .BR nexttoward () .\"O functions do the same as the .\"O .BR nextafter () .\"O functions, except that they have a .\"O .I "long double" .\"O second argument. .BR nexttoward () 関数群は、2 番目の引き数が .I long double 型である点以外、 .BR nextafter () 関数群と同じはたらきをする。 .\"O .SH RETURN VALUE .SH 返り値 .\"O On success, .\"O these functions return the next representable floating-point value after .\"O .I x .\"O in the direction of .\"O .IR y . 成功すると、これらの関数は \fIy\fP に向かう方向で \fIx\fP の すぐ次の浮動小数点数表現を返す。 .\"O If .\"O .I x .\"O equals .\"O .IR y , .\"O then .\"O .I y .\"O (cast to the same type as .\"O .IR x ) .\"O is returned. .I x が .I y と等しい場合、 .RI ( x と同じ型にキャストされた) .I y が返される。 .\"O If .\"O .I x .\"O or .\"O .I y .\"O is a NaN, .\"O a NaN is returned. .I x か .I y が NaN の場合、NaN が返される。 .\"O If .\"O .I x .\"O is finite, .I x が有限値で .\" e.g., DBL_MAX .\"O and the result would overflow, .\"O a range error occurs, .\"O and the functions return .\"O .BR HUGE_VAL , .\"O .BR HUGE_VALF , .\"O or .\"O .BR HUGE_VALL , .\"O respectively, with the correct mathematical sign. 結果がオーバーフローする場合、 範囲エラー (range error) が発生し、 各関数はそれぞれ .BR HUGE_VAL , .BR HUGE_VALF , .B HUGE_VALL を返す。返り値には数学的に正しい符号が付与される。 .\"O If .\"O .I x .\"O is not equal to .\"O .IR y , .\"O and the correct function result would be subnormal, zero, or underflow, .\"O a range error occurs, .\"O and either the correct value (if it can be represented), .\"O or 0.0, is returned. .I x が .I y と同じではなく、正しい関数の結果が非正規化数かゼロかアンダーフローの場合、 範囲エラーが発生し、 (表現可能な場合には) 正しい値が、(そうでない場合には) 0.0 が返される。 .\"O .SH ERRORS .SH エラー .\"O See .\"O .BR math_error (7) .\"O for information on how to determine whether an error has occurred .\"O when calling these functions. これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は .BR math_error (7) を参照のこと。 .PP .\"O The following errors can occur: 以下のエラーが発生する可能性がある。 .TP .\"O Range error: result overflow 範囲エラー: 結果のオーバーフロー .\" e.g., nextafter(DBL_MAX, HUGE_VAL); .\" .I errno .\" is set to .\" .BR ERANGE . .\"O An overflow floating-point exception .\"O .RB ( FE_OVERFLOW ) .\"O is raised. オーバーフロー浮動小数点例外 .RB ( FE_OVERFLOW ) が上がる。 .TP .\"O Range error: result is subnormal or underflows 範囲エラー: 結果が非正規化数かアンダーフロー .\" e.g., nextafter(DBL_MIN, 0.0); .\" .I errno .\" is set to .\" .BR ERANGE . .\"O An underflow floating-point exception .\"O .RB ( FE_UNDERFLOW ) .\"O is raised. アンダーフロー浮動小数点例外 .RB ( FE_UNDERFLOW ) が上がる。 .PP .\"O These functions do not set .\"O .IR errno . これらの関数は .I errno を設定しない。 .\" FIXME . Is it intentional that these functions do not set errno? .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6799 .\"O .SH "CONFORMING TO" .SH 準拠 C99, POSIX.1-2001. .\"O This function is defined in IEC 559 (and the appendix with .\"O recommended functions in IEEE 754/IEEE 854). この関数は IEC 559 で定義されている。 (また IEEE 754/IEEE 854 では付録で推奨関数として定義されている) .\"O .SH BUGS .SH バグ .\"O In glibc version 2.5 and earlier, these functions do not raise an underflow .\"O floating-point .\"O .RB ( FE_UNDERFLOW ) .\"O exception when an underflow occurs. glibc バージョン 2.5 以前では、アンダーフローが発生した際に、 これらの関数はアンダーフロー浮動小数点例外 .RB ( FE_UNDERFLOW ) を上がない。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR nearbyint (3)