Returns the cosinus of x (radians).
If x is ±INFINITY, the function returns -NAN.
Example:
writefln("cos(0) is %f",cos(0));
writefln("cos(PI/2) is %f",cos(PI/2));
writefln("cos(PI/4) is %f",cos(PI/4));
writefln("cos(INF) is %f",cos(float.infinity));
writefln("cos(-INF) is %f",cos(-float.infinity));
|
Output:
cos(0) is 1.000000
cos(PI/2) is 0.000000
cos(PI/4) is 0.707107
cos(INF) is -nan
cos(-INF) is -nan |
See also:
std.math - Constants (PI)
|