Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      HUGE_VALF, HUGE_VAL, HUGE_VALL

      From cppreference.com
      <c‎ |numeric‎ |math
       
       
       
      Common mathematical functions
      Functions
      Basic operations
      (C99)
      (C99)
      (C99)
      (C99)(C99)(C99)(C23)
      Maximum/minimum operations
      (C99)
      (C99)
      Exponential functions
      (C23)
      (C99)
      (C99)
      (C23)
      (C23)

      (C99)
      (C99)(C23)
      (C23)
      (C23)
      Power functions
      (C99)
      (C23)
      (C23)

      (C99)
      (C23)
      (C23)
      Trigonometric and hyperbolic functions
      (C23)
      (C23)
      (C23)
      (C23)
      (C99)
      (C99)
      (C99)
      Nearest integer floating-point
      (C99)(C99)(C99)
      (C23)(C23)(C23)(C23)
      Floating-point manipulation
      (C99)(C99)
      (C99)(C23)
      (C99)
      Narrowing operations
      (C23)
      (C23)
      (C23)
      (C23)
      (C23)
      (C23)
      Quantum and quantum exponent
      Decimal re-encoding functions
      Total order and payload functions
      Classification
      Error and gamma functions
      (C99)
      (C99)
      (C99)
      (C99)
      Types
      Macro constants
      Special floating-point values
      HUGE_VALHUGE_VALFHUGE_VALLHUGE_VALDN
      (C99)(C99)(C23)
      (C99)(C23)
      Arguments and return values
      Error handling
      Fast operation indicators
       
      Defined in header<math.h>
      #define HUGE_VALF /*implementation defined*/
      (since C99)
      #define HUGE_VAL  /*implementation defined*/
      #define HUGE_VALL /*implementation defined*/
      (since C99)

      TheHUGE_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]Example

      Run this code
      #include <math.h>#include <stdio.h> int main(void){constdouble result=1.0/0.0;printf("1.0/0.0 == %f\n", result);if(result== HUGE_VAL)puts("1.0/0.0 == HUGE_VAL");}

      Possible output:

      1.0/0.0 == inf1.0/0.0 == HUGE_VAL

      [edit]References

      • C23 standard (ISO/IEC 9899:2024):
      • 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD)
      • F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD)
      • C17 standard (ISO/IEC 9899:2018):
      • 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD)
      • F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: TBD)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 231)
      • F.10/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 517)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.12/3 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 212)
      • F.9/2 HUGE_VAL, HUGE_VALF, HUGE_VALL (p: 454)
      • C89/C90 standard (ISO/IEC 9899:1990):
      • 4.5 HUGE_VAL

      [edit]See also

      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=c/numeric/math/HUGE_VAL&oldid=172024"

      [8]ページ先頭

      ©2009-2025 Movatter.jp