Rate This Document
Findability
Accuracy
Completeness
Readability

sind

Compute the sine of the input angle.

Interface Definition

C interface:

float sindf(float x);

double sind(double x);

double sind_18(double x);

long double sindl(long double x);

sind_18 is provided only in the high-precision version.

Parameters

Parameter

Type

Description

Input/Output

x

  • For sindf, x is of single-precision floating-point type.
  • For sind and sind_18, x is of double-precision floating-point type.
  • For sindl, x is of long double-precision floating-point type.

Floating-point value representing an angle.

Input

Return Value

  • The sine y of 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
25
26
27
28
29
    // typical usage
    double x1 = 90.0, x2 = -90.0, x3 = 45.0, x4 = -45.0, x5 = 30.0, x6 = -30.0;
    double a = 0.0, b = INFINITY, c = -INFINITY, d = NAN;
    // print result
    printf("sind(90.0) = %.15f\n", sind(x1));
    printf("sind(-90.0) = %.15f\n", sind(x2));
    printf("sind(45.0) = %.15f\n", sind(x3));
    printf("sind(-45.0) = %.15f\n", sind(x4));
    printf("sind(30.0) = %.15f\n", sind(x5));
    printf("sind(-30.0) = %.15f\n", sind(x6));
    printf("sind(0.0) = %.15f\n", sind(a));
    printf("sind(-0.0) = %.15f\n", sind(-a));
    printf("sind(INFINITY) = %.15f\n", sind(b));
    printf("sind(-INFINITY) = %.15f\n", sind(c));
    printf("sind(NAN) = %.15f\n", sind(d));
    /* 
     * sind(90.0) = 1.000000000000000
     * sind(-90.0) = -1.000000000000000
     * sind(45.0) = 0.707106781186548
     * sind(-45.0) = -0.707106781186548
     * sind(30.0) = 0.500000000000000
     * sind(-30.0) = -0.500000000000000
     * sind(0.0) = 0.000000000000000
     * sind(-0.0) = -0.000000000000000
     * sind(INFINITY) = nan
     * sind(-INFINITY) = nan
     * sind(NAN) = nan
     * 
     * */