sin -- Compute the Trigonometric Sine

SYNOPSIS

 #include <math.h>

 double sin(double x);
 

DESCRIPTION

sin computes the trigonometric sine of its argument x expressed in radians. Because the sine function is periodic, only the value of x mod 2 pi is used to compute the sine. If x is very large, only a limited precision is left to represent x mod 2 pi. Thus, an error message is written for very large negative or positive arguments (see DIAGNOSTICS).

RETURN VALUE

sin returns the principal value of the sine of the argument x, if this value is defined and computable. The return value is of type double.

DIAGNOSTICS

For a very large argument (x > 6.7465e9), the function returns 0.0. In this case, the message "total loss of significance" is also written to stderr (the standard error file).

If an error occurs in sin, the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

EXAMPLE

This example computes the trigonometric cosecant of a value:
  #include <stdio.h>
  #include <math.h>

  #define SVECTOR .7854

  main()
  {
     double cosec;

        /* The cosecant of a value is 1 divided */
        /*  by the sine.                        */
     cosec = 1 / sin(SVECTOR);
     printf("1 / sin(%f) = %fn", SVECTOR, cosec);
  }

 

RELATED FUNCTIONS

cos, _matherr, tan

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.