fdim
Section: C Library Functions (3)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
fdim, fdimf, fdiml - 正の差分を計算する
ライブラリ
数学ライブラリ (libm,~-lm)
書式
#include <math.h>
double fdim(double x, double y);
float fdimf(float x, float y);
long double fdiml(long double x, long double y);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
fdimf(), fdiml():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
説明
These functions return the positive difference, max(x-y,0), between their
arguments.
返り値
成功すると、これらの関数は正の差分を返す。
x か y が NaN の場合、NaN が返される。
結果がオーバーフローする場合、範囲エラー (range error) が発生し、 各関数はそれぞれ HUGE_VAL, HUGE_VALF,
HUGE_VALL を返す。
エラー
これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は math_error(7) を参照のこと。
以下のエラーが発生する可能性がある。
- 範囲エラー (range error): 結果のオーバーフロー
-
errno に ERANGE が設定される。 オーバーフロー浮動小数点例外 (FE_OVERFLOW) が上がる。
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
fdim(),
fdimf(),
fdiml()
| Thread safety | MT-Safe
|
標準規格
C11, POSIX.1-2008.
歴史
glibc 2.1. C99, POSIX.1-2001.
バグ
Before glibc 2.24 on certain architectures (e.g., x86, but not x86_64)
these functions did not set errno.
関連項目
fmax(3)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- 属性
-
- 標準規格
-
- 歴史
-
- バグ
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.