sin

Returns sine of x. x is in radians.

$(TH3 x , sin(x) , invalid?) $(TD3 $(NAN) , $(NAN) , yes ) $(TD3 $(PLUSMN)0.0, $(PLUSMN)0.0, no ) $(TD3 $(PLUSMNINF), $(NAN) , yes )
Special Values
  1. real sin(real x)
    pragma(inline, true) @safe pure nothrow @nogc
    real
    sin
    (
    real x
    )
  2. double sin(double x)
  3. float sin(float x)

Parameters

x real

angle in radians (not degrees)

Return Value

Type: real

sine of x

Bugs

Results are undefined if |x| >= 264.

Examples

import std.math.constants : PI;
import std.stdio : writefln;

void someFunc()
{
  real x = 30.0;
  auto result = sin(x * (PI / 180)); // convert degrees to radians
  writefln("The sine of %s degrees is %s", x, result);
}

See Also

Meta