fmaのヘルプ・マニュアル
日本語 英語
fma --help
man fma
FMA(3) Linux Programmer’s Manual FMA(3)
名前
fma, fmaf, fmal - 浮動小数点数の積と和を計算する
書式
#include
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y, long double z);
-lm でリンクする。
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
fma(), fmaf(), fmal(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or
cc -std=c99
説明
fma() 関数は x * y + z を計算する。結果は、一つの三項演算として現在の丸
めモードにしたがって丸められる (fenv(3) 参照)。
返り値
これらの関数は x * y + z の、一つの三項演算として丸められた値を返す。
x か y が NaN の場合、NaN が返される。
y の x 倍がちょうど無限大で、 z がそれとは反対の符号の無限大の場合、領
域エラー (domain error) が発生し、NaN が返される。
x と y のうち一方が無限大で、もう一方が 0 で、 z が NaN でない場合、 領
域エラーが発生し、NaN が返される。
x と y のうち一方が無限大で、もう一方が 0 で、 z が NaN の場合、領域エ
ラーが発生し、NaN が返される。
y の x 倍が 0 の無限大倍 (もしくはその逆) ではなく、 z が NaN の 場 合
、NaN が返される。
結果がオーバーフローする場合、範囲エラー (range error) が発生し、正しい
符号の無限大が返される。
結果がアンダーフローする場合、範囲エラーが発生し、符号付きの 0 が返され
る。
エラー
こ れらの関数を呼び出した際にエラーが発生したかの判定方法についての情報
は math_error(7) を参照のこと。
以下のエラーが発生する可能性がある。
領域エラー: x * y + z か x * y が無効で、z が NaN ではない
不正 (invalid) 浮動小数点例外 (FE_INVALID) が上がる。
範囲エラー: 結果のオーバーフロー
オーバーフロー浮動小数点例外 (FE_OVERFLOW) が上がる。
範囲エラー: 結果のアンダーフロー
アンダーフロー浮動小数点例外 (FE_UNDERFLOW) が上がる。
これらの関数は errno を設定しない。
バージョン
これらの関数は glibc バージョン 2.1 で初めて登場した。
準拠
C99, POSIX.1-2001.
関連項目
remainder(3), remquo(3)
2008-10-06 FMA(3)
FMA(3) Linux Programmer’s Manual FMA(3)
NAME
fma, fmaf, fmal - floating-point multiply and add
SYNOPSIS
#include
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y, long double z);
Link with -lm.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fma(), fmaf(), fmal(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or
cc -std=c99
DESCRIPTION
The fma() function computes x * y + z. The result is rounded as one
ternary operation according to the current rounding mode (see fenv(3)).
RETURN VALUE
These functions return the value of x * y + z, rounded as one ternary
operation.
If x or y is a NaN, a NaN is returned.
If x times y is an exact infinity, and z is an infinity with the oppo-
site sign, a domain error occurs, and a NaN is returned.
If one of x or y is an infinity, the other is 0, and z is not a NaN, a
domain error occurs, and a NaN is returned.
If one of x or y is an infinity, and the other is 0, and z is a NaN, a
domain error occurs, and a NaN is returned.
If x times y is not an infinity times zero (or vice versa), and z is a
NaN, a NaN is returned.
If the result overflows, a range error occurs, and an infinity with the
correct sign is returned.
If the result underflows, a range error occurs, and a signed 0 is
returned.
ERRORS
See math_error(7) for information on how to determine whether an error
has occurred when calling these functions.
The following errors can occur:
Domain error: x * y + z, or x * y is invalid and z is not a NaN
An invalid floating-point exception (FE_INVALID) is raised.
Range error: result overflow
An overflow floating-point exception (FE_OVERFLOW) is raised.
Range error: result underflow
An underflow floating-point exception (FE_UNDERFLOW) is raised.
These functions do not set errno.
VERSIONS
These functions first appeared in glibc in version 2.1.
CONFORMING TO
C99, POSIX.1-2001.
SEE ALSO
remainder(3), remquo(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2008-10-06 FMA(3)