名前空間
変種
操作

浮動小数点拡張パート1: 2進浮動小数点算術

提供: cppreference.com

C のための浮動小数点拡張パート1: 2進浮動小数点算術 (ISO/IEC TS 18661-1:2014) は、 ISO/IEC/IEEE 60559:2011 (IEEE-754 の現在のリビジョン) によって推奨されている、 C 標準ライブラリのための新しい以下のコンポーネントを定義します。

__STDC_IEC_60559_BFP__
integer constant of type long and value 201ymmL, replaces __STDC_IEC_559__
(マクロ定数)
__STDC_IEC_60559_COMPLEX__
integer constant of type long and value 201ymmL, replaces __STDC_IEC_559_COMPLEX__
(マクロ定数)
ヘッダ <limits.h> で定義
CHAR_WIDTH SCHAR_WIDTH UCHAR_WIDTHSHRT_WIDTH USHRT_WIDTHINT_WIDTH UINT_WIDTHLONG_WIDTH ULONG_WIDTHLLONG_WIDTH ULLONG_WIDTH
(FP Ext 1 TS)
width, in bits, of the corresponding type
(マクロ定数)
ヘッダ <float.h> で定義
(FP Ext 1 TS)
conversions between all supported binary floating-point types and character sequences with at most CR_DECIMAL_DIG significant decimal digits are correctly rounded (this is at least DECIMAL_DIG + 3)
(マクロ定数)
ヘッダ <fenv.h> で定義
femode_t
(FP Ext 1 TS)
collection of dynamic floating-point control modes supported by the implementation, including the dynamic rounding direction mode
(typedef)
FE_DFL_MODE
(FP Ext 1 TS)
pointer to the default femode_t
(マクロ定数)
FE_SNANS_ALWAYS_SIGNAL
(FP Ext 1 TS)
defined (as integer constant 1) if sNaN arguments cause the functions that suppress qNaNs, like hypot or fmax, to raise FE_INVALID and return a qNaN
(マクロ定数)
(FP Ext 1 TS)
sets the specified floating-point exception flags without causing any side-effects that raising them would
(関数)
(FP Ext 1 TS)
tests if given flags are in a saved representation of the floating-point exception flags
(関数)
(FP Ext 1 TS)
gets and sets all the implementation’s dynamic floating-point control modes collectively
(関数)
ヘッダ <stdint.h> で定義
INTn_WIDTH UINTn_WIDTHINT_LEASTn_WIDTH UINT_LEASTn_WIDTHINT_FASTn_WIDTH UINT_FASTn_WIDTHINTPTR_WIDTH UINTPTR_WIDTHINTMAX_WIDTH UINTMAX_WIDTHPTRDIFF_WIDTHSIG_ATOMIC_WIDTHSIZE_WIDTHWCHAR_WIDTH WINT_WIDTH
(FP Ext 1 TS)
width, in bits, of the corresponding type
(マクロ定数)
ヘッダ <stdlib.h> で定義
convert a single foating-point number to string using the specified snprintf format
(関数)
ヘッダ <math.h> で定義
FP_INT_UPWARDFP_INT_DOWNWARDFP_INT_TOWARDZERO FP_INT_TONEARESTFROMZEROFP_INT_TONEAREST
(FP Ext 1 TS)
rounding direction for the functions ceil, floor, trunc, round, and roundeven, suitable for use with fromfp family of functions
(マクロ定数)
FP_LLOGB0
(FP Ext 1 TS)
value returned by llogb if the argument is zero
(マクロ定数)
FP_LLOGBNAN
(FP Ext 1 TS)
value returned by llogb if the argument is NaN
(マクロ定数)
(FP Ext 1 TS)
represents a signalling NaN for float, double, long double respectively
(マクロ定数)
FP_FAST_FADD FP_FAST_FADDL FP_FAST_DADDLFP_FAST_FSUB FP_FAST_FSUBL FP_FAST_DSUBLFP_FAST_FMUL FP_FAST_FMULL FP_FAST_DMULLFP_FAST_FDIV FP_FAST_FDIVL FP_FAST_DDIVLFP_FAST_FFMA FP_FAST_FFMAL FP_FAST_DFMALFP_FAST_FSQRT FP_FAST_FSQRTL FP_FAST_DSQRTL
(FP Ext 1 TS)
if defined, indicates that the corresponding function executes faster than the equivalent function in a larger type followed by a cast to target type
(マクロ定数)
iseqsig
(FP Ext 1 TS)

(関数マクロ)
iscanonical
(FP Ext 1 TS)
tests if the floating-point value is canonical
(関数マクロ)
issignaling
(FP Ext 1 TS)
tests if the floating-point value is a signalling NaN
(関数マクロ)
issubnormal
(FP Ext 1 TS)
tests if the floating-point value is subnormal
(関数マクロ)
iszero
(FP Ext 1 TS)
tests if the floating-point value is a zero (positive, negative, unsigned)
(関数マクロ)
round to signed integer using the specified rounding direction
(関数)
round to unsigned integer using the specified rounding direction
(関数)
round to signed integer using the specified rounding direction, reporting inexactness
(関数)
round to unsigned integer using the specified rounding direction, reporting inexactness
(関数)
rounds to nearest, halfway cases to even
(関数)
(FP Ext 1 TS)
equivalent to logb except the return type is long
(関数)
returns the value of their argument of maximum magnitude
(関数)
returns the value of their argument of minimum magnitude
(関数)
returns the next greater representable floating-point value
(関数)
returns the next smaller representable floating-point value
(関数)
(FP Ext 1 TS)
calculates x+y as if in infinite precision and rounded once to target type
(関数)
(FP Ext 1 TS)
calculates x-y as if in infinite precision and rounded once to target type
(関数)
(FP Ext 1 TS)
calculates x*y as if in infinite precision and rounded once to target type
(関数)
(FP Ext 1 TS)
calculates x/y as if in infinite precision and rounded once to target type
(関数)
(FP Ext 1 TS)
calculates the same as fma as if in infinite precision and rounded once to target type
(関数)
(FP Ext 1 TS)
calculates the same as sqrt as if in infinite precision and rounded once to target type
(関数)
orders two floating-point values using the ISO 60559 total order relation
(関数)
orders the magnitudes of two floating-point values using the ISO 60559 total order relation
(関数)
obtains the ISO 60559 canonical binary encoding of the given floating-point value
(関数)
extracts the payload from the given NaN value
(関数)
creates a quiet NaN with the specified payload
(関数)
creates a signalling NaN with the specified payload
(関数)
ヘッダ <tgmath.h> で定義
roundeven
(FP Ext 1 TS)
generic overload of roundeven
(関数)
llogb
(FP Ext 1 TS)
generic overload of llogb
(関数)
fmaxmag
(FP Ext 1 TS)
generic overload of fmaxmag
(関数)
fminmag
(FP Ext 1 TS)
generic overload of fminmag
(関数)
nextup
(FP Ext 1 TS)
generic overload of nextup
(関数)
nextdown
(FP Ext 1 TS)
generic overload of nextdown
(関数)
fromfp
(FP Ext 1 TS)
generic overload of fromfp
(関数)
ufromfp
(FP Ext 1 TS)
generic overload of ufromfp
(関数)
fromfpx
(FP Ext 1 TS)
generic overload of fromfpx
(関数)
ufromfpx
(FP Ext 1 TS)
generic overload of ufromfpx
(関数)
nextdown
(FP Ext 1 TS)
generic overload of nextdown
(関数)
totalorder
(FP Ext 1 TS)
generic overload of totalorder
(関数)
totalordermag
(FP Ext 1 TS)
generic overload of totalordermag
(関数)
fadd
(FP Ext 1 TS)
generic overload of fadd
(関数)
dadd
(FP Ext 1 TS)
generic overload of dadd
(関数)
fsub
(FP Ext 1 TS)
generic overload of fsub
(関数)
dsub
(FP Ext 1 TS)
generic overload of dsub
(関数)
fmul
(FP Ext 1 TS)
generic overload of fmul
(関数)
dmul
(FP Ext 1 TS)
generic overload of dmul
(関数)
fdiv
(FP Ext 1 TS)
generic overload of fdiv
(関数)
ddiv
(FP Ext 1 TS)
generic overload of ddiv
(関数)
ffma
(FP Ext 1 TS)
generic overload of ffma
(関数)
dfma
(FP Ext 1 TS)
generic overload of dfma
(関数)
fsqrt
(FP Ext 1 TS)
generic overload of fsqrt
(関数)
dsqrt
(FP Ext 1 TS)
generic overload of dsqrt
(関数)

[編集]ノート

標準 C のマクロ __STDC_IEC_559__ および __STDC_IEC_559_COMPLEX__ はこの技術仕様書によって時代遅れになります。

この拡張によって C のライブラリに追加される関数およびマクロはすべて、対応するヘッダがインクルードされる前にマクロ __STDC_WANT_IEC_60559_BFP_EXT__ が定義されている場合にのみ宣言されます。

標準ライブラリへの追加に加えて、 ISO/IEC TS 18661-1:2014 はコア言語に対する多数の変更を行います。 特に、浮動小数点制御を静的なもの (新しい #pragma STDC FENV_ROUND によって制御される) と動的なもの (fesetround によって制御される) に分割します。 <math.h> のほとんどの関数は、設定されていれば、動的な丸めモードよりも静的な丸めモードを尊重します。

close