<numeric> library in C++ STL

Common mathematical functions

  • std::fabs: This function returns the absolute value.
  • std::sqrt: This function returns the square root
  • std::sin: This function returns the sine measured in radians.

Special mathematical functions

  • std::beta: This function evaluates the (complete) Beta integral with given parameters
  • std::hermite: This function Returns the value of the Hermite Polynomial of order n at point x
  • std::cyl_bessel_i: This function returns value of the regular modified cylindrical Bessel function.

Complex number arithmetic



  • complex: a complex number class, defined in header (class template)

Numeric arrays

  • valarray : numeric arrays, array masks and array slices (class template)

Factor operations(Defined in header )

  • gcd: constexpr function template returning the greatest common divisor of two integers. (function template)
  • lcm: constexpr function template returning the least common multiple of two integers (function template)

Numeric operations(Defined in header )

  • iota: fills a range with successive increments of the starting value (function template)
  • accumulate: sums up a range of elements (function template)
  • reduce: similar to std::accumulate, except out of order (function template)
  • transform_reduce: applies a functor, then reduces out of order (function template)
  • inner_product: computes the inner product of two ranges of elements .(function template)
  • adjacent_difference: computes the differences between adjacent elements in a range (function template)
  • partial_sum: computes the partial sum of a range of elements (function template)
  • inclusive_scan: similar to std::partial_sum, includes the ith input element in the ith sum (function template)
  • exclusive_scan: similar to std::partial_sum, excludes the ith input element from the ith sum (function template)
  • transform_inclusive_scan: applies a functor, then calculates inclusive scan (function template)
  • transform_exclusive_scan: applies a functor, then calculates exclusive scan (function template)

More Useful Links



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.