cos

Returns cosine of x.

@IEEECompliant("cos", 42)
D
cos
(
D
)
(
auto const ref D x
)

Throws

InvalidOperationExceptionx is signaling NaN or ±∞
UnderflowExceptionresult is too small to be represented
InexactExceptionthe result is inexact

Special values

xcos(x)
NaNNaN
±∞NaN
±0.0+1.0
π/6+√3/2
π/4+√2/2
π/3+0.5
π/2+0.0
2π/3-0.5
3π/4-√2/2
5π/6-√3/2
π-1.0

Meta