-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sintau/costau consistent with sinpi/cospi #19
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
========================================
+ Coverage 94.44% 100% +5.55%
========================================
Files 2 2
Lines 54 61 +7
========================================
+ Hits 51 61 +10
+ Misses 3 0 -3
Continue to review full report at Codecov.
|
Thanks for doing this! I should be able to do a proper review in the weekend. |
I added more extensive tests. I always compare the results with For the record, the new methods of julia> z = complex(0.0, 0.0)
0.0 + 0.0im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 34.275 ns (0.00% GC)
median time: 36.908 ns (0.00% GC)
mean time: 37.036 ns (0.00% GC)
maximum time: 87.059 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 993
julia> z = complex(-1.0, 1.0)
-1.0 + 1.0im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 87.628 ns (0.00% GC)
median time: 87.806 ns (0.00% GC)
mean time: 89.831 ns (0.00% GC)
maximum time: 208.251 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 963
julia> z = complex(3.5, -2.7)
3.5 - 2.7im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 121.915 ns (0.00% GC)
median time: 122.128 ns (0.00% GC)
mean time: 123.617 ns (0.00% GC)
maximum time: 346.113 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 909 After the PR: julia> z = complex(0.0, 0.0)
0.0 + 0.0im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 10.041 ns (0.00% GC)
median time: 10.047 ns (0.00% GC)
mean time: 10.090 ns (0.00% GC)
maximum time: 29.297 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 999
julia> z = complex(-1.0, 1.0)
-1.0 + 1.0im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 35.591 ns (0.00% GC)
median time: 35.624 ns (0.00% GC)
mean time: 35.943 ns (0.00% GC)
maximum time: 71.093 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 993
julia> z = complex(3.5, -2.7)
3.5 - 2.7im
julia> @benchmark sintau($z)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 118.415 ns (0.00% GC)
median time: 118.493 ns (0.00% GC)
mean time: 120.525 ns (0.00% GC)
maximum time: 226.772 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 911 I believe that there is much room for improvement in the |
Adapt implementations of complex sintau/costau from those of sinpi/cospi in Julia Standard Library.
LGTM. Nice that the test coverage has reached 100% :) I would like to discuss the |
Note that this PR makes the test fail on Julia 0.4 (see #13) because in Julia 0.4:
while in Julia 0.5 and later
I also changed the first test to
because it's exactly the fact that
tau
isn't the same as2 * pi
that makes this package particularly useful.