Chapter Contents |
Previous |
Next |
sin |
Portability: | ISO/ANSI C conforming, UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
DIAGNOSTICS | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
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 is used to compute the sine. If
x
is very large, only a limited precision is left to represent x mod
2. 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) = %f\n", SVECTOR, cosec); }
RELATED FUNCTIONS |
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.