sin
Compute the sine of the input radian.
Interface Definition
C interface:
float sinf(float x);
double sin(double x);
long double sinl(long double x);
long double sinl_18(long double x);
sinl_18 is provided only in the high-precision version.
Fortran interface:
RES = SINF(X);
RES = SIN(X);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of a radian angle. |
Input |
Return Value
- The sine y of radian angle x is returned. y ∈ [-1, +1]
- If the input is +0, the return value is +0.
- If the input is -0, the return value is -0.
- If the input is ±∞, the return value is NaN.
- If the input is NaN, the return value is NaN.
Dependencies
C: "km.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | double pi = acos(-1); // typical usage double a = pi/6, b = 1.0, c = -3*pi/4, d = pi/3; // special handling double e = INFINITY, f = -INFINITY, g = NAN; double complex k = 0 + 0 * I; // print result printf("sin(pi/6) = %.15f\n", sin(a)); printf("sin(1.0) = %.15f\n", sin(b)); printf("sin(-3*pi/4) = %.15f\n", sin(c)); printf("sin(pi/3) = %.15f\n", sin(d)); printf("sin(INFINITY) = %.15f\n", sin(e)); printf("sin(-INFINITY) = %.15f\n", sin(f)); printf("sin(NAN) = %.15f\n", sin(g)); /* * sin(pi/6) = 0.500000000000000 * sin(1.0) = 0.841470984807897 * sin(-3*pi/4) = -0.707106781186548 * sin(pi/3) = 0.866025403784438 * sin(INFINITY) = nan * sin(-INFINITY) = nan * sin(NAN) = nan * * */ |
Fortran interface:
REAL(8) :: X = 1.0
PRINT*, SIN(X)
!
! OUTPUT
! 0.841470984807897
!
Parent topic: Trigonometric Functions