Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Common mathematical functions

      From cppreference.com
      <cpp‎ |numeric
       
       
       
      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
       

      Contents

      [edit]Functions

      Defined in header<cstdlib>
      computes absolute value of an integral value (\(\small{|x|}\)|x|)
      (function)[edit]
      computes quotient and remainder of integer division
      (function)[edit]
      Defined in header<cinttypes>
      computes absolute value of an integral value (\(\small{|x|}\)|x|)
      (function)[edit]
      computes quotient and remainder of integer division
      (function)[edit]
      Defined in header<cmath>
      Basic operations
      absolute value of a floating point value (\(\small{|x|}\)|x|)
      (function)[edit]
      (C++11)(C++11)
      remainder of the floating point division operation
      (function)[edit]
      (C++11)(C++11)(C++11)
      signed remainder of the division operation
      (function)[edit]
      (C++11)(C++11)(C++11)
      signed remainder as well as the three last bits of the division operation
      (function)[edit]
      (C++11)(C++11)(C++11)
      fused multiply-add operation
      (function)[edit]
      (C++11)(C++11)(C++11)
      larger of two floating-point values
      (function)[edit]
      (C++11)(C++11)(C++11)
      smaller of two floating point values
      (function)[edit]
      (C++11)(C++11)(C++11)
      positive difference of two floating point values (\({\small\max{(0, x-y)}}\)max(0, x-y))
      (function)[edit]
      (C++11)(C++11)(C++11)
      not-a-number (NaN)
      (function)[edit]
      Exponential functions
      (C++11)(C++11)
      returnse raised to the given power (\({\small e^x}\)ex)
      (function)[edit]
      (C++11)(C++11)(C++11)
      returns2 raised to the given power (\({\small 2^x}\)2x)
      (function)[edit]
      (C++11)(C++11)(C++11)
      returnse raised to the given power, minus1 (\({\small e^x-1}\)ex-1)
      (function)[edit]
      (C++11)(C++11)
      computes natural (basee) logarithm (\({\small\ln{x}}\)ln(x))
      (function)[edit]
      (C++11)(C++11)
      computes common (base10) logarithm (\({\small\log_{10}{x}}\)log10(x))
      (function)[edit]
      (C++11)(C++11)(C++11)
      base2 logarithm of the given number (\({\small\log_{2}{x}}\)log2(x))
      (function)[edit]
      (C++11)(C++11)(C++11)
      natural logarithm (to basee) of1 plus the given number (\({\small\ln{(1+x)}}\)ln(1+x))
      (function)[edit]
      Power functions
      (C++11)(C++11)
      raises a number to the given power (\(\small{x^y}\)xy)
      (function)[edit]
      (C++11)(C++11)
      computes square root (\(\small{\sqrt{x}}\)x)
      (function)[edit]
      (C++11)(C++11)(C++11)
      computes cube root (\(\small{\sqrt[3]{x}}\)3x)
      (function)[edit]
      (C++11)(C++11)(C++11)
      computes hypotenuse\(\scriptsize{\sqrt{x^2+y^2}}\)x2
      +y2
      and\(\scriptsize{\sqrt{x^2+y^2+z^2}}\)x2
      +y2
      +z2
      (since C++17)

      (function)[edit]
      Trigonometric functions
      (C++11)(C++11)
      computes sine (\({\small\sin{x}}\)sin(x))
      (function)[edit]
      (C++11)(C++11)
      computes cosine (\({\small\cos{x}}\)cos(x))
      (function)[edit]
      (C++11)(C++11)
      computes tangent (\({\small\tan{x}}\)tan(x))
      (function)[edit]
      (C++11)(C++11)
      computes arc sine (\({\small\arcsin{x}}\)arcsin(x))
      (function)[edit]
      (C++11)(C++11)
      computes arc cosine (\({\small\arccos{x}}\)arccos(x))
      (function)[edit]
      (C++11)(C++11)
      computes arc tangent (\({\small\arctan{x}}\)arctan(x))
      (function)[edit]
      (C++11)(C++11)
      arc tangent, using signs to determine quadrants
      (function)[edit]
      Hyperbolic functions
      (C++11)(C++11)
      computes hyperbolic sine (\({\small\sinh{x}}\)sinh(x))
      (function)[edit]
      (C++11)(C++11)
      computes hyperbolic cosine (\({\small\cosh{x}}\)cosh(x))
      (function)[edit]
      (C++11)(C++11)
      computes hyperbolic tangent (\({\small\tanh{x}}\)tanh(x))
      (function)[edit]
      (C++11)(C++11)(C++11)
      computes the inverse hyperbolic sine (\({\small\operatorname{arsinh}{x}}\)arsinh(x))
      (function)[edit]
      (C++11)(C++11)(C++11)
      computes the inverse hyperbolic cosine (\({\small\operatorname{arcosh}{x}}\)arcosh(x))
      (function)[edit]
      (C++11)(C++11)(C++11)
      computes the inverse hyperbolic tangent (\({\small\operatorname{artanh}{x}}\)artanh(x))
      (function)[edit]
      Error and gamma functions
      (C++11)(C++11)(C++11)
      error function
      (function)[edit]
      (C++11)(C++11)(C++11)
      complementary error function
      (function)[edit]
      (C++11)(C++11)(C++11)
      gamma function
      (function)[edit]
      (C++11)(C++11)(C++11)
      natural logarithm of the gamma function
      (function)[edit]
      Nearest integer floating point operations
      (C++11)(C++11)
      nearest integer not less than the given value
      (function)[edit]
      (C++11)(C++11)
      nearest integer not greater than the given value
      (function)[edit]
      (C++11)(C++11)(C++11)
      nearest integer not greater in magnitude than the given value
      (function)[edit]
      (C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
      nearest integer, rounding away from zero in halfway cases
      (function)[edit]
      (C++11)(C++11)(C++11)
      nearest integer using current rounding mode
      (function)[edit]
      (C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
      nearest integer using current rounding mode with
      exception if the result differs
      (function)[edit]
      Floating point manipulation functions
      (C++11)(C++11)
      decomposes a number into significand and base-2 exponent
      (function)[edit]
      (C++11)(C++11)
      multiplies a number by2 raised to an integral power
      (function)[edit]
      (C++11)(C++11)
      decomposes a number into integer and fractional parts
      (function)[edit]
      (C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
      multiplies a number byFLT_RADIX raised to a power
      (function)[edit]
      (C++11)(C++11)(C++11)
      extracts exponent of the number
      (function)[edit]
      (C++11)(C++11)(C++11)
      extracts exponent of the number
      (function)[edit]
      (C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
      next representable floating-point value towards the given value
      (function)[edit]
      (C++11)(C++11)(C++11)
      copies the sign of a floating point value
      (function)[edit]
      Classification and comparison
      (C++11)
      categorizes the given floating-point value
      (function)[edit]
      (C++11)
      checks if the given number has finite value
      (function)[edit]
      (C++11)
      checks if the given number is infinite
      (function)[edit]
      (C++11)
      checks if the given number is NaN
      (function)[edit]
      (C++11)
      checks if the given number is normal
      (function)[edit]
      (C++11)
      checks if the given number is negative
      (function)[edit]
      (C++11)
      checks if the first floating-point argument is greater than the second
      (function)[edit]
      checks if the first floating-point argument is greater or equal than the second
      (function)[edit]
      (C++11)
      checks if the first floating-point argument is less than the second
      (function)[edit]
      checks if the first floating-point argument is less or equal than the second
      (function)[edit]
      checks if the first floating-point argument is less or greater than the second
      (function)[edit]
      checks if two floating-point values are unordered
      (function)[edit]

      [edit]Types

      Defined in header<cstdlib>
      structure type, returned bystd::div
      (typedef)[edit]
      structure type, returned bystd::ldiv
      (typedef)[edit]
      (C++11)
      structure type, returned bystd::lldiv
      (typedef)[edit]
      Defined in header<cinttypes>
      (C++11)
      structure type, returned bystd::imaxdiv
      (typedef)[edit]
      Defined in header<cmath>
      float_t
      (C++11)
      most efficient floating-point type at least as wide asfloat
      (typedef)[edit]
      double_t
      (C++11)
      most efficient floating-point type at least as wide asdouble
      (typedef)[edit]

      [edit]Macro constants

      Defined in header<cmath>
      indicates the overflow value forfloat,double andlongdouble respectively
      (macro constant)[edit]
      (C++11)
      evaluates to positive infinity or the value guaranteed to overflow afloat
      (macro constant)[edit]
      (C++11)
      evaluates to a quiet NaN of typefloat
      (macro constant)[edit]
      defines the error handling mechanism used by the common mathematical functions
      (macro constant)[edit]
      Classification
      (C++11)(C++11)(C++11)(C++11)(C++11)
      indicates a floating-point category
      (macro constant)[edit]

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_constexpr_cmath202202L(C++23)Constexpr for FP environment agnostic mathematical functions in<cmath> and<cstdlib>
      202306L(C++26)Constexpr for most mathematical functions in<cmath>

      [edit]See also

      Mathematical special functions
      C documentation forCommon mathematical functions
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math&oldid=159219"

      [8]ページ先頭

      ©2009-2025 Movatter.jp