Common mathematical functions

From cppreference.com
 
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 48 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 47 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 46 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 44 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 43 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 42 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 41 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 40 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 38 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 37 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 36 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 35 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 34 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 33 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 31 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE (哋它亢11)
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 30 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 29 MINUTES 29 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
 
 
Common mathematical functions
Types
(哋它亢99)(哋它亢99)    

(哋它亢99)(哋它亢99)    
(哋它亢23)(哋它亢23)

Functions
Basic operations
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢23)
Maximum/minimum operations
Exponential functions
(哋它亢99)(哋它亢23)
Power functions
Trigonometric and hyperbolic functions
Error and gamma functions
Nearest integer floating-point operations
(哋它亢99)(哋它亢99)(哋它亢99)
Floating-point manipulation functions
Narrowing operations
Quantum and quantum exponent functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Decimal re-encoding functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Total order and payload functions
Classification
Macro constants
Special floating-point values
(哋它亢99)(哋它亢99)(哋它亢23)
(哋它亢99)(哋它亢23)
(哋它亢99)(哋它亢23)
Arguments and return values
(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)    
(哋它亢23)(哋它亢23)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)    
Error handling
(哋它亢99)(哋它亢99)
Fast operation indicators
(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)    
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢99)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
 

Functions

Defined in header <stdlib.h>
(哋它亢99)
computes absolute value of an integral value (|x|)
(function)
(哋它亢99)
computes quotient and remainder of integer division
(function)
Defined in header <inttypes.h>
(哋它亢99)
computes absolute value of an integral value (|x|)
(function)
(哋它亢99)
computes quotient and remainder of integer division
(function)
Defined in header <math.h>
Basic operations
(哋它亢99)(哋它亢99)
computes absolute value of a floating-point value (|x|)
(function)
(哋它亢99)(哋它亢99)
computes remainder of the floating-point division operation
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes signed remainder of the floating-point division operation
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes signed remainder as well as the three last bits of the division operation
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes fused multiply-add operation
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
determines larger of two floating-point values
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
determines smaller of two floating-point values
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
determines positive difference of two floating-point values (max(0, x-y))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
returns a NaN (not-a-number)
(function)
Exponential functions
(哋它亢99)(哋它亢99)
computes e raised to the given power (ex)
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes 2 raised to the given power (2x)
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes e raised to the given power, minus one (ex-1)
(function)
(哋它亢99)(哋它亢99)
computes natural (base-e) logarithm (ln(x))
(function)
(哋它亢99)(哋它亢99)
computes common (base-10) logarithm (log10(x))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes base-2 logarithm (log2(x))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes natural (base-e) logarithm of 1 plus the given number (ln(1+x))
(function)
Power functions
(哋它亢99)(哋它亢99)
computes a number raised to the given power (xy)
(function)
(哋它亢99)(哋它亢99)
computes square root (x)
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes cube root (3x)
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes square root of the sum of the squares of two given numbers (x2
+y2
)
(function)
Trigonometric functions
(哋它亢99)(哋它亢99)
computes sine (sin(x))
(function)
(哋它亢99)(哋它亢99)
computes cosine (cos(x))
(function)
(哋它亢99)(哋它亢99)
computes tangent (tan(x))
(function)
(哋它亢99)(哋它亢99)
computes arc sine (arcsin(x))
(function)
(哋它亢99)(哋它亢99)
computes arc cosine (arccos(x))
(function)
(哋它亢99)(哋它亢99)
computes arc tangent (arctan(x))
(function)
(哋它亢99)(哋它亢99)
computes arc tangent, using signs to determine quadrants
(function)
Hyperbolic functions
(哋它亢99)(哋它亢99)
computes hyperbolic sine (sinh(x))
(function)
(哋它亢99)(哋它亢99)
computes hyperbolic cosine (cosh(x))
(function)
(哋它亢99)(哋它亢99)
computes hyperbolic tangent (tanh(x))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes inverse hyperbolic sine (arsinh(x))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes inverse hyperbolic cosine (arcosh(x))
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes inverse hyperbolic tangent (artanh(x))
(function)
Error and gamma functions
(哋它亢99)(哋它亢99)(哋它亢99)
computes error function
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes complementary error function
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes gamma function
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
computes natural (base-e) logarithm of the gamma function
(function)
Nearest integer floating-point operations
(哋它亢99)(哋它亢99)
computes smallest integer not less than the given value
(function)
(哋它亢99)(哋它亢99)
computes largest integer not greater than the given value
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
rounds to nearest integer not greater in magnitude than the given value
(function)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)
rounds to nearest integer, rounding away from zero in halfway cases
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
rounds to an integer using current rounding mode
(function)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)
rounds to an integer using current rounding mode with
exception if the result differs
(function)
Floating-point manipulation functions
(哋它亢99)(哋它亢99)
breaks a number into significand and a power of 2
(function)
(哋它亢99)(哋它亢99)
multiplies a number by 2 raised to a power
(function)
(哋它亢99)(哋它亢99)
breaks a number into integer and fractional parts
(function)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)
computes efficiently a number times MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 27 MINUTES 19 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE raised to a power
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
extracts exponent of the given number
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
extracts exponent of the given number
(function)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)
determines next representable floating-point value towards the given value
(function)
(哋它亢99)(哋它亢99)(哋它亢99)
produces a value with the magnitude of a given value and the sign of another given value
(function)
Classification and comparison
(哋它亢99)
classifies the given floating-point value
(function macro)
(哋它亢99)
checks if the given number has finite value
(function macro)
(哋它亢99)
checks if the given number is infinite
(function macro)
(哋它亢99)
checks if the given number is NaN
(function macro)
(哋它亢99)
checks if the given number is normal
(function macro)
(哋它亢99)
checks if the given number is negative
(function macro)
(哋它亢99)
checks if the first floating-point argument is greater than the second
(function macro)
(哋它亢99)
checks if the first floating-point argument is greater or equal than the second
(function macro)
(哋它亢99)
checks if the first floating-point argument is less than the second
(function macro)
(哋它亢99)
checks if the first floating-point argument is less or equal than the second
(function macro)
(哋它亢99)
checks if the first floating-point argument is less or greater than the second
(function macro)
(哋它亢99)
checks if two floating-point values are unordered
(function macro)

Types

Defined in header <stdlib.h>
structure type, return of the MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 27 MINUTES 17 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE function
(typedef)
structure type, return of the MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 08 HOURS 27 MINUTES 16 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE function
(typedef)
(哋它亢99)
structure type, return of the lldiv function
(typedef)
Defined in header <inttypes.h>
(哋它亢99)
structure type, return of the imaxdiv function
(typedef)
Defined in header <math.h>
(哋它亢99)(哋它亢99)
most efficient floating-point type at least as wide as float or double
(typedef)

Macro constants

Defined in header <math.h>
(哋它亢99)(哋它亢99)
indicates value too big to be representable (infinity) by float, double and long double respectively
(macro constant)
(哋它亢99)
evaluates to positive infinity or the value guaranteed to overflow a float
(macro constant)
(哋它亢99)
evaluates to a quiet NaN of type float
(macro constant)
(哋它亢99)(哋它亢99)(哋它亢99)
indicates that the fma function generally executes about as fast as, or faster than, a multiply and an add of double operands
(macro constant)
(哋它亢99)(哋它亢99)
evaluates to ilogb(x) if x is zero or NaN, respectively
(macro constant)
(哋它亢99)(哋它亢99)(哋它亢99)
defines the error handling mechanism used by the common mathematical functions
(macro constant)
Classification
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)
indicates a floating-point category
(macro constant)

References

  • 哋它亢17 standard (ISO/IEC 9899:2018):
  • 7.8 Format conversion of integer types <inttypes.h> (p: 158-160)
  • 7.12 Mathematics <math.h> (p: 169-190)
  • 7.22 General utilities <stdlib.h> (p: 248-262)
  • 7.31.5 Format conversion of integer types <inttypes.h> (p: 332)
  • 7.31.12 General utilities <stdlib.h> (p: 333)
  • 哋它亢11 standard (ISO/IEC 9899:2011):
  • 7.8 Format conversion of integer types <inttypes.h> (p: 217-220)
  • 7.12 Mathematics <math.h> (p: 231-261)
  • 7.22 General utilities <stdlib.h> (p: 340-360)
  • 7.31.5 Format conversion of integer types <inttypes.h> (p: 455)
  • 7.31.12 General utilities <stdlib.h> (p: 456)
  • 哋它亢99 standard (ISO/IEC 9899:1999):
  • 7.8 Format conversion of integer types <inttypes.h> (p: 198-201)
  • 7.12 Mathematics <math.h> (p: 212-242)
  • 7.20 General utilities <stdlib.h> (p: 306-324)
  • 7.26.4 Format conversion of integer types <inttypes.h> (p: 401)
  • 7.26.10 General utilities <stdlib.h> (p: 402)
  • 哋它亢89/C90 standard (ISO/IEC 9899:1990):
  • 4.5 MATHEMATICS <math.h>
  • 4.10 GENERAL UTILITIES <stdlib.h>
  • 4.13.4 Mathematics <math.h>
  • 7.13.7 General utilities <stdlib.h>

See also