名前空間
変種
操作

std::feraiseexcept

提供: cppreference.com
< cpp‎ | numeric‎ | fenv

 
 
ニューメリックスライブラリ
一般的な数学関数
浮動小数点環境
複素数
数値配列
擬似乱数生成
コンパイル時有理数演算 (C++11)
汎用の数値演算
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota(C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
浮動小数点環境
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
feclearexcept(C++11)
fetestexcept(C++11)
feraiseexcept(C++11)
fegetexceptflag
fesetexceptflag
(C++11)
(C++11)
fegetround
fesetround
(C++11)
(C++11)
fegetenv
fesetenv
(C++11)
feholdexcept(C++11)
feupdateenv(C++11)
マクロ定数
Original:
Macro constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
FE_ALL_EXCEPT
FE_DIVBYZERO
FE_INEXACT
FE_INVALID
FE_OVERFLOW
FE_UNDERFLOW
(C++11)
FE_DOWNWARD
FE_TONEAREST
FE_TOWARDZERO
FE_UPWARD
(C++11)
FE_DFL_ENV(C++11)
 
Defined in header <cfenv>
int feraiseexcept( int excepts );
(C++11およびそれ以降)
ビット単位の論理和(ORexceptsの)小数点例外マクロが浮かんでいますに記載されているすべての浮動小数点例外を発生しようとします。例外の一つがFE_OVERFLOWまたはFE_UNDERFLOWの場合、この関数はさらにFE_INEXACTを上げることができる。例外が発生する順序はその場合を除き、指定されていないFE_OVERFLOWFE_UNDERFLOW常にFE_INEXACT前に発生します.
Original:
Attempts to raise all floating point exceptions listed in excepts (a bitwise OR of the 小数点例外マクロが浮かんでいます). If one of the exceptions is FE_OVERFLOW or FE_UNDERFLOW, this function may additionally raise FE_INEXACT. The order in which the exceptions are raised is unspecified, except that FE_OVERFLOW and FE_UNDERFLOW are always raised before FE_INEXACT.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

excepts -
上げるために例外フラグをリストするビットマスク
Original:
bitmask listing the exception flags to raise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

そうでなければ、リストされたすべての例外が発生した0場合は、ゼロ以外の値.
Original:
0 if all listed exceptions were raised, non-zero value otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <iostream>
#include <cfenv>
 
#pragma STDC FENV_ACCESS ON
 
int main()
{
    std::feclearexcept(FE_ALL_EXCEPT);
    int r = std::feraiseexcept(FE_UNDERFLOW | FE_DIVBYZERO);
    std::cout <<  "Raising divbyzero and underflow simultaneously "
              << (r?"fails":"succeeds") << " and results in\n";
    int e = std::fetestexcept(FE_ALL_EXCEPT);
    if (e & FE_DIVBYZERO) {
        std::cout << "division by zero\n";
    }
    if (e & FE_INEXACT) {
        std::cout << "inexact\n";
    }
    if (e & FE_INVALID) {
        std::cout << "invalid\n";
    }
    if (e & FE_UNDERFLOW) {
        std::cout << "underflow\n";
    }
    if (e & FE_OVERFLOW) {
        std::cout << "overflow\n";
    }
}

Output:

Raising divbyzero and underflow simultaneously succeeds and results in
division by zero
underflow

[編集] も参照してください

指定された浮動小数点ステータスフラグをクリアします
Original:
clears the specified floating-point status flags
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
設定されている指定された浮動小数点状態フラグのかを決定します
Original:
determines which of the specified floating-point status flags are set
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]