Numerical Operations

C++ is particularly powerful at engineering and scientific applications, which require intensive numerical calculations. There is the full range of mathematical functions inherited from C, now including versions that work with complex numbers. There are standard algorithms defined in <numeric>, which do full and partial sums of sequences. There is also the valarray class, which is optimized for high-performance applications and works like a mathematical vector.

Mathematical Functions: <cmath>

All the mathematical functions take double arguments and return double values. (In addition, C++ makes complex versions available.) Be careful with functions like sqrt(), log(), and pow() that are not defined for all values of x; this ...

Get C++ By Example: UnderC Learning Edition now with O’Reilly online learning.

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