6.2. Math Library Functions
Sometimes functions, such as
main, are not members of a class. Such functions are called global functions. Like a class’s member functions, the function prototypes for global functions are placed in headers, so that the global functions can be reused in any program that includes the header and that can link to the function’s object code. For example, recall that we used function
pow of the
<cmath> header to raise a value to a power in Fig. 5.6. We introduce various functions from the
<cmath> header here to present the concept of global functions that do not belong to a particular class.
<cmath> header provides a collection of functions that enable you to perform common mathematical calculations. For example, you ...