sin()

Computes the sine of a radian value.

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

x

A floating point value, in radians.

Remarks

These functions return the sine of x.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of sin()

#include <math.h>

#include <stdio.h>

#define DegtoRad (2.0*pi/360.0)

int main(void)

{

double x = 57.0;

double xRad = x*DegtoRad;

printf("The sine of %.2f degrees is %.4f.\n",x, sin(xRad));

return 0;

}

Output:

The sine of 57.00 degrees is 0.8387.