The Math Library

The math library contains many useful mathematical functions. The math.h header file provides the function declarations or prototypes for these functions. Table 16.2 lists several functions declared in math.h. Note that all angles are measured in radians. (One radian = 180/π = 57.296 degrees.) (Reference Section V, “The Standard ANSI C Library,” supplies a complete list of the functions specified by the C99 standard.)

Table 16.2. ANSI C Standard Math Functions
Prototype Description
double acos(double x) Returns the angle (0 to π radians) whose cosine is x
double asin(double x) Returns the angle (-π/2 to π/2 radians) whose sine is x
double atan(double x) Returns the angle (-π/2 to π/2 radians) whose tangent is x
double atan2(double ...

Get C Primer Plus, Fourth Edition 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.