From the course: C Standard Library

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Trigonometric functions

Trigonometric functions - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

Trigonometric functions

- [Narrator] Let me quickly walk you through the basic trigonometric functions present in math.h. The default type used for most functions in math.h is double. So here are the double versions of sine, cosine, and tangent. They receive a double representing an angle, and return a double as the result. Inverse trigonometric functions are also implemented. Here we have the arcsine, the arccosine, and the arctangent, which receive real numbers and return angles. These functions check the validity of the argument. For example, if 1.5 is sent to the arcsine function, it returns an invalid value, like NAN, or not a number. If you have worked with trigonometry in computers long enough, you may have come across some implementation of the atan2 function. This is a better implementation of the arctangent. Simply put, the arctangent is often used to calculate the angle of a complex number seen as a right triangle by dividing the vertical leg by the horizontal leg. And this division is sent as an…

Contents