cospi

Compute the cosine of π*x, where x expressed in half-revolutions.

Methods

julia> methods(cospi, (Any,), [Base, Base.Math, Base.MathConstants, Base.MPFR])# 7 methods for generic function "cospi" from Base.Math:
 [1] cospi(x::BigFloat)
     @ mpfr.jl:946
 [2] cospi(::Missing)
     @ math.jl:1548
 [3] cospi(x::T) where T<:Union{Float16, Float32, Float64}
     @ special/trig.jl:829
 [4] cospi(x::AbstractFloat)
     @ special/trig.jl:940
 [5] cospi(x::Integer)
     @ special/trig.jl:935
 [6] cospi(x::Real)
     @ math.jl:1543
 [7] cospi(z::Complex{T}) where T
     @ special/trig.jl:978

Examples

Real Numbers

julia> cospi(0)
1.0

julia> cospi(-0.0)
1.0

julia> cospi(0.5)
0.0

julia> cospi(1)
-1.0

Complex

julia> cospi(0+0im)
1.0 - 0.0im

Tips

See Also

cos

Extended Inputs

Tech Notes

  • cospi(::Real): by pure julia
  • cospi(::BigFloat): by MPFR

Version History

Introduced in Julia v1.0 (2018)