• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    variable
    <limits>

    std::numeric_limits::min_exponent

    // C++03
    static const int min_exponent;
    
    // C++11
    static constexpr int min_exponent;
    

    概要

    浮動小数点数型において、型Tの指数下限値を得る。
    基数radixmin_exponent - 1の値で累乗した値が、型Tで表現可能な正規化された値となる最小の負の値。
    浮動小数点数以外は0となる。

    対応するマクロを次の表に挙げる。

    対応するマクロ
    float FLT_MIN_EXP
    double DBL_MIN_EXP
    long double LDBL_MIN_EXP

    #include <iostream>
    #include <limits>
    
    int main()
    {
      constexpr int f = std::numeric_limits<float>::min_exponent;
      constexpr int d = std::numeric_limits<double>::min_exponent;
    
      std::cout << "float : " << f << std::endl;
      std::cout << "double : " << d << std::endl;
    }
    

    出力

    float : -125
    double : -1021
    

    参照