cosd
Compute the cosine of x expressed in degrees.
Base.Math.cosd — Function
cosd(x::T) where T -> float(T)Compute cosine of x, where x is in degrees. If x is a matrix, x needs to be a square matrix.
Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).
Methods
julia> methods(cosd, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])# 3 methods for generic function "cosd" from Base.Math: [1] cosd(x::BigFloat) @ mpfr.jl:966 [2] cosd(x::Real) @ special/trig.jl:1240 [3] cosd(x) @ special/trig.jl:1299
Examples
Real Numbers
julia> cosd(0)
1.0
julia> cosd(-0.0)
1.0
julia> cosd(60)
0.5
julia> cosd(90)
0.0
julia> cosd(180)
-1.0Complex
julia> cosd(0+0im)
1.0 - 0.0imTips
See Also
Extended Inputs
Tech Notes
- Implemented in terms of
cos:cosd(deg) = cos(deg2rad(deg))
Version History
Introduced in Julia v1.0 (2018)