| << Prev | Beej's Guide to C | Next >> |
Calculate the sine of a number.
#include <math.h> double sin(double x); float sinf(float x); long double sinl(long double x);
Calculates the sine of the value x, where x is in radians.
For those of you who don't remember, radians are another way of measuring an angle, just like degrees. To convert from degrees to radians or the other way around, use the following code:
degrees = radians * 180.0f / M_PI; radians = degrees * M_PI / 180;
Returns the sine of x. The variants return different types.
double sinx; long double ldsinx; sinx = sin(3490.0); // round and round we go! ldsinx = sinl((long double)3.490);
| << Prev | Beej's Guide to C | Next >> |