Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Numerical problems are often subtle. If you are not 100% certain about the mathematical aspects of a numerical problem, either take expert advice or experiment; §22.1.
Use numeric_limits to determine properties of built-in types; §22.2.
Specialize numeric_limits for user-defined scalar types; §22.2.
Use valarray for numeric computation when run-time efficiency is more important than flexibility with respect to operations and element types; §22.4.
Express operations on part of an array in terms of slices rather than loops; §22.4.6.
Use compositors to gain efficiency through elimination of temporaries and better algorithms; §22.4.7.
Use std::complex for complex arithmetic; §22.5.
You can convert old code that uses a complex class to use the std:: complex template by using a typedef; §22.5.
Consider accumulate(), inner_product(), partial_sum(), and adjacent_difference() before you write a loop to compute a value from a list; §22.6.
Prefer a random-number class for a particular distribution over direct use of rand(); §22.7.
Be careful that your random numbers are sufficiently random; §22.7.