Skip to content

Commit aca5c27

Browse files
authored
Add sincospi (#727)
1 parent aaa2e41 commit aca5c27

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Compat"
22
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
3-
version = "3.22.0"
3+
version = "3.23.0"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ changes in `julia`.
5555

5656
## Supported features
5757

58+
* `sincospi(x)` for calculating the tuple `(sinpi(x), cospi(x))` ([#35816]) (since Compat 3.23)
59+
5860
* `Dates.canonicalize` can now take a `Period` as an input ([#37391]) (since Compat 3.22)
5961

6062
* Import renaming is available through the `@compat` macro, e.g. `@compat import LinearAlgebra as LA` and
@@ -227,3 +229,4 @@ Note that you should specify the correct minimum version for `Compat` in the
227229
[#35243]: https://github.com/JuliaLang/julia/pull/35243
228230
[#37396]: https://github.com/JuliaLang/julia/pull/37396
229231
[#37391]: https://github.com/JuliaLang/julia/pull/37391
232+
[#35816]: https://github.com/JuliaLang/julia/pull/35816

src/Compat.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,12 @@ if VERSION < v"1.6.0-DEV.820"
814814
Dates.canonicalize(p::Period) = Dates.canonicalize(CompoundPeriod(p))
815815
end
816816

817+
# https://github.com/JuliaLang/julia/pull/35816
818+
if VERSION < v"1.6.0-DEV.292" # 6cd329c371c1db3d9876bc337e82e274e50420e8
819+
export sincospi
820+
sincospi(x) = (sinpi(x), cospi(x))
821+
end
822+
817823
include("iterators.jl")
818824
include("deprecated.jl")
819825

test/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,15 @@ end
765765
@test Dates.canonicalize(Dates.Minute(24*60*1 + 12*60)) == Dates.canonicalize(Dates.CompoundPeriod([Dates.Day(1),Dates.Hour(12)]))
766766
end
767767

768+
# https://github.com/JuliaLang/julia/pull/35816
769+
@testset "sincospi(x)" begin
770+
@test sincospi(0.13) == (sinpi(0.13), cospi(0.13))
771+
@test sincospi(1//3) == (sinpi(1//3), cospi(1//3))
772+
@test sincospi(5) == (sinpi(5), cospi(5))
773+
@test sincospi(ℯ) == (sinpi(ℯ), cospi(ℯ))
774+
@test sincospi(0.13im) == (sinpi(0.13im), cospi(0.13im))
775+
end
776+
768777
include("iterators.jl")
769778

770779
# Import renaming, https://github.com/JuliaLang/julia/pull/37396,

0 commit comments

Comments
 (0)