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.1 lists several functions declared in math.h. Note that all angles are measured in radians. (One radian = 180/π = 57.296 degrees.) (Appendix F, "The Standard ANSI C Library," supplies a complete list of the functions specified by the C90 standard.)

Table 16.1. ANSI C standard math functions.
PrototypeDescription
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®, Third 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.