Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      HUGE_VALF, HUGE_VAL, HUGE_VALL

      From cppreference.com
      <cpp‎ |numeric‎ |math
       
       
       
      Common mathematical functions
      Nearest integer floating point operations
      (C++11)(C++11)(C++11)
      (C++11)
      (C++11)
      (C++11)(C++11)(C++11)
      Floating point manipulation functions
      (C++11)(C++11)
      (C++11)
      (C++11)
      Classification and comparison
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      Types
      (C++11)
      (C++11)
      (C++11)
      Macro constants
      HUGE_VALFHUGE_VALHUGE_VALL
      (C++11)(C++11)
      (C++11)
      (C++11)
       
      Defined in header<cmath>
      #define HUGE_VALF /* implementation defined */
      (since C++11)
      #define HUGE_VAL  /* implementation defined */
      #define HUGE_VALL /* implementation defined */
      (since C++11)

      The macrosHUGE_VALF,HUGE_VAL andHUGE_VALL macros expand to positive floating point constant expressions which compare equal to the values returned by floating-point functions and operators in case of overflow (seemath_errhandling).

      Constant Explanation
      HUGE_VALF Expands to positivefloat expression that indicates overflow
      HUGE_VAL Expands to positivedouble expression that indicates overflow, not necessarily representable as afloat
      HUGE_VALL Expands to positivelongdouble expression that indicates overflow, not necessarily representable as afloat ordouble

      On implementations that support floating-point infinities, these macros always expand to the positive infinities offloat,double, andlongdouble, respectively.

      [edit]Notes

      On implementations that do not support floating-point infinities, these macros expand to the maximum finite number of their respective types.

      C++98 addedfloat andlongdouble overloads of mathematical functions. There is a problem that thefloat overloads cannot returnHUGE_VAL to indicate overflow because this macro is not guaranteed to be representable as afloat.

      LWG issue 357 was raised to target this problem. LWG found that C99 has the same problem (float andlongdouble overloads were also added in C99), and C99 introduced new macrosHUGE_VALF andHUGE_VALL to solve the problem. Therefore the issue was closed and the C99 resolution was adopted in C++11.

      [edit]See also

      (C++11)
      evaluates to positive infinity or the value guaranteed to overflow afloat
      (macro constant)[edit]
      C documentation forHUGE_VAL
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math/HUGE_VAL&oldid=147795"

      [8]ページ先頭

      ©2009-2025 Movatter.jp