GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — FE_ALL_EXCEPT - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. cfenv
  3. FE_ALL_EXCEPT

最終更新日時: 2026年09月11日 13時06分31秒 (JST)
Akira Takahashi が更新

履歴 編集

macro
<cfenv>

FE_ALL_EXCEPT(C++11)

#define FE_ALL_EXCEPT unspecified

概要

全ての浮動小数点例外マクロをビットORでつなぐことによって実装で定義されるマクロ。

このマクロは、全ての浮動小数点例外をクリアしたり、全ての浮動小数点例外の状態を取得するような状況で使用する。

例

#include <iostream>
#include <cfenv>

int main()
{
  // ゼロ割りを発生させる
  float result = 1.0f / 0.0f;

  // 全ての浮動小数点例外の状態を取得
  int excepts = std::fetestexcept(FE_ALL_EXCEPT);
  if (excepts & FE_DIVBYZERO) { // 個別の例外送出状態を判定
    std::cout << "zero divided" << std::endl;
  }

  // 全ての浮動小数点例外の状態をクリア
  std::feclearexcept(FE_ALL_EXCEPT);
}

出力例

zero divided

バージョン

言語

  • C++11

処理系

  • Clang: 3.0 ✅
  • GCC: 4.3.0 ✅
  • Visual C++: 2013 ✅, 2015 ✅
    • コンパイルオプション/fp:strictまたは#pragma fenv_access (on)が必要。さもなくば、正しく動作しないおそれがある。
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.