• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    variable
    <limits>

    std::numeric_limits::tinyness_before

    // C++03
    static const bool tinyness_before;
    
    // C++11
    static constexpr bool tinyness_before;
    

    概要

    浮動小数点数型において、型Tが丸めが行われる前に小さな値になることを検出できる場合はtrue、そうでなければfalseとなる。

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

    出力例

    float : false
    double : false