tanpi

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

Base.Math.tanpiFunction
tanpi(x::T) where T -> float(T)

Compute $\tan(\pi x)$ more accurately than tan(pi*x), especially for large x.

Throw a DomainError if isinf(x), return a T(NaN) if isnan(x).

Julia 1.10

This function requires at least Julia 1.10.

See also tand, sinpi, cospi, sincospi.

source

Methods

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

Examples

Real Numbers

julia> tanpi(0)
0.0

julia> tanpi(-0.0)
-0.0

julia> tanpi(0.5)
Inf

julia> tanpi(1.0)
-0.0

julia> tanpi(2.0)
0.0

Complex

julia> tanpi(0+0im)
0.0 + 0.0im

Tips

See Also

tan

Extended Inputs

Tech Notes

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

Version History

Introduced in Julia v1.10 (2023)

  • C23 F.10.1.14