From 6a4d87a2e89c1966e5e95670f407c92b570b42dd Mon Sep 17 00:00:00 2001 From: hyrodium Date: Wed, 1 Mar 2023 00:28:07 +0900 Subject: [PATCH 1/2] =?UTF-8?q?remove=20sin=CF=84,=20cos=CF=84,=20sincos?= =?UTF-8?q?=CF=84,=20cis=CF=84,=20and=20mod=CF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Tau.jl | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Tau.jl b/src/Tau.jl index af91e98..5402fa4 100644 --- a/src/Tau.jl +++ b/src/Tau.jl @@ -3,20 +3,18 @@ module Tau import IrrationalConstants export tau, τ, - sintau, costau, sincostau, cistau, modtau, - sinτ, cosτ, sincosτ, cisτ, modτ + sintau, costau, sincostau, cistau, modtau # Definition of τ as irrational constant const τ = IrrationalConstants.twoπ const tau = τ -const modτ = mod2pi -const modtau = modτ +const modtau = mod2pi # Trigonometric functions -sinτ(x) = sinpi(2 * x) -cosτ(x) = cospi(2 * x) -function sincosτ(x) +sintau(x) = sinpi(2 * x) +costau(x) = cospi(2 * x) +function sincostau(x) y = 2 * x # sincospi was added in https://github.com/JuliaLang/julia/pull/35816 @static if VERSION < v"1.6.0-DEV.292" @@ -25,29 +23,24 @@ function sincosτ(x) return sincospi(y) end end -cisτ(x::Real) = complex(reverse(sincosτ(x))...) -function cisτ(z::Complex) - sitau, cotau = sincosτ(z) +cistau(x::Real) = complex(reverse(sincostau(x))...) +function cistau(z::Complex) + sitau, cotau = sincostau(z) re_sitau, im_sitau = reim(sitau) re_cotau, im_cotau = reim(cotau) return complex(re_cotau - im_sitau, im_cotau + re_sitau) end # Optimization for integers -sinτ(x::Integer) = zero(float(x)) -cosτ(x::Integer) = one(float(x)) -function sincosτ(x::Integer) +sintau(x::Integer) = zero(float(x)) +costau(x::Integer) = one(float(x)) +function sincostau(x::Integer) y = float(x) return (zero(y), one(y)) end -function cisτ(x::Integer) +function cistau(x::Integer) y = float(x) return complex(one(y), zero(y)) end -const sintau = sinτ -const costau = cosτ -const sincostau = sincosτ -const cistau = cisτ - end From bf826d466ecf57fb65f30858b9a915c61170b92e Mon Sep 17 00:00:00 2001 From: hyrodium Date: Wed, 1 Mar 2023 00:28:21 +0900 Subject: [PATCH 2/2] =?UTF-8?q?remove=20tests=20for=20sin=CF=84,=20cos?= =?UTF-8?q?=CF=84,=20sincos=CF=84,=20cis=CF=84,=20and=20mod=CF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/runtests.jl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 0bc6c7f..23e9b8d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -110,12 +110,6 @@ end end end - @testset "aliases" begin - @test sinτ === sintau - @test cosτ === costau - @test sincosτ === sincostau - @test cisτ === cistau - end end # Adapted from julia/test/mod2pi.jl @@ -131,5 +125,4 @@ end # aliases @test modtau === mod2pi - @test modτ === modtau end