15.1. sin(), sinf(), sinl()

Calculate the sine of a number.

Prototypes

#include <math.h>
double sin(double x);
float sinf(float x);
long double sinl(long double x);

Description

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;

Return Value

Returns the sine of x. The variants return different types.

Example

double sinx;
long double ldsinx;

sinx = sin(3490.0); // round and round we go!
ldsinx = sinl((long double)3.490);

See Also

cos(), tan(), asin()