cos

Returns cosine of x. x is in radians.

Special Values
xcos(x)invalid?
NaNNaNyes
±∞NaNyes
  1. real cos(real x)
  2. double cos(double x)
    pragma(inline, true) @safe pure nothrow @nogc
    double
    cos
    (
    double x
    )
  3. float cos(float x)

Bugs

Results are undefined if |x| >= 264.

Examples

import std.math.operations : isClose;

assert(cos(0.0) == 1.0);
assert(cos(1.0).isClose(0.5403023059));
assert(cos(3.0).isClose(-0.9899924966));

Meta