Chapter 31. Working with Numerics

<feature>
  • Learn about the standard math functions

  • See how to generate random numbers

  • Learn about complex numbers and valarrays

  • Explore the generic numeric algorithms

</feature>

Identifying Numeric Headers

The Standard C++ Library provides loads of functionality for numeric processing, a common programming task. Table 31.1 describes each of the standard headers that support numeric operations for standard C++.

Table 31.1. Standard Headers That Support Numeric Operations

Header

Purpose

<cmath>

Includes the standard C header <math.h> within the std namespace, providing standard math functions.

<cstdlib>

Includes the standard C header <stdlib.h> within the std namespace, providing random number generation.

<complex>

Provides a ...

Get Practical C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.