std.math.sin
- multiple declarations
- Function sin
- Function sin
Function sin
Returns sine for complex and imaginary arguments.
sin
(z
) = sin
(z.re)*cosh
(z.im) + cos
(z.re)*sinh
(z.im)i
If both sin
(θ) and cos
(θ) are required,
it is most efficient to use expi
(θ).
Prototypes
creal sin( creal z ) pure nothrow @nogc @safe; ireal sin( ireal y ) pure nothrow @nogc @safe;
Example
assert(sin(0.0+0.0i) == 0.0); assert(sin(2.0+0.0i) == sin(2.0L) );
Function sin
Returns sine of x
. x
is in radians.
Prototypes
real sin( real x ) pure nothrow @nogc @safe; double sin( double x ) pure nothrow @nogc @safe; float sin( float x ) pure nothrow @nogc @safe;
Parameters
Name | Description |
---|---|
x | angle in radians (not degrees) |
Returns
sine of x
See Also
Bugs
Results are undefined if |x
| >= 2,64.
Example
import std.math : sin, 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); }
Authors
Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw