View source code Display the source code in std/math.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.math.cos - multiple declarations

Function cos

Returns cosine of x. x is in radians.

x cos(x) invalid? yes ±∞ yes

Prototypes

real cos(
  real x
) pure nothrow @nogc @safe;

double cos(
  double x
) pure nothrow @nogc @safe;

float cos(
  float x
) pure nothrow @nogc @safe;

Bugs

Results are undefined if |x| >= 2,64.

Function cos

cosine, complex and imaginary

cos(z) = cos(z.re)*cosh(z.im) - sin(z.re)*sinh(z.im)i

Prototypes

creal cos(
  creal z
) pure nothrow @nogc @safe;

real cos(
  ireal y
) pure nothrow @nogc @safe;

Example

assert(cos(0.0+0.0i)==1.0);
assert(cos(1.3L+0.0i)==cos(1.3L));
assert(cos(5.2Li)== cosh(5.2L));

Authors

Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw

License

Boost License 1.0.

Comments