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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.