C Programming Absolute Beginner's Guide (3rd Edition)

(Romina) #1
TABLE 20.1 C Trigonometric Functions

Again, it’s unlikely you will need these functions, unless you want to relearn trigonometry (or have a
child or relative taking the class and want to check their homework), but it’s good to know the
capabilities of your programming language.


Tip

If you want to supply an argument in degrees instead of radians, you can convert from
degrees to radians with this formula:
Click here to view code image
radians = degrees * (3.14159 / 180.0);

Table 20.2 shows the primary log functions.


TABLE 20.2 C Logarithmic Functions

The following program uses the math functions described in this chapter:


Click here to view code image


// Example program #1 from Chapter 20 of Absolute Beginner's Guide
// to C, 3rd Edition
// File Chapter20ex1.c
/* This program demonstrates the math functions from the C math.h
library, so that you can get your homework right thanks to some
quick-and-easy programming. */
#include <stdio.h>
#include <string.h>
Free download pdf