Skip to content

Commit 605ee5e

Browse files
pkofodararslan
authored andcommitted
Add atan benchmarks. (#103)
1 parent 80b6862 commit 605ee5e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/scalar/ScalarBenchmarks.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,31 @@ for T in (Float32, Float64)
487487
g["0.5 <= abs(x) < 1", "negative argument", _arg_string] = @benchmarkable acos($T(-0.6))
488488
end
489489

490+
########
491+
# atan #
492+
########
493+
494+
# Before calculating atan(x) a range reduction is performed. The various inter-
495+
# vals below are chosen such that all branches of the reduction and evaluation
496+
# phases are reached and benchmarked.
497+
498+
g = addgroup!(SUITE, "atan")
499+
for T in (Float32, Float64)
500+
_arg_string = arg_string(T)
501+
g["zero", _arg_string] = @benchmarkable atan($(zero(T)))
502+
g["very small", "positive argument", _arg_string] = @benchmarkable atan($(nextfloat(zero(T))))
503+
g["very small", "negative argument", _arg_string] = @benchmarkable atan($(prevfloat(zero(T))))
504+
g["very large", "positive argument", _arg_string] = @benchmarkable atan($(T(2.0)^67))
505+
g["very large", "negative argument", _arg_string] = @benchmarkable atan($(-T(2.0)^67))
506+
g["0 <= abs(x) < 7/16", "positive argument", _arg_string] = @benchmarkable atan($(T(6/16)))
507+
g["0 <= abs(x) < 7/16", "negative argument", _arg_string] = @benchmarkable atan($(-T(6/16)))
508+
g["7/16 <= abs(x) < 11/16", "positive argument", _arg_string] = @benchmarkable atan($(T(10/16)))
509+
g["7/16 <= abs(x) < 11/16", "negative argument", _arg_string] = @benchmarkable atan($(-T(10/16)))
510+
g["11/16 <= abs(x) < 19/16", "positive argument", _arg_string] = @benchmarkable atan($(T(18/16)))
511+
g["11/16 <= abs(x) < 19/16", "negative argument", _arg_string] = @benchmarkable atan($(-T(18/16)))
512+
g["19/16 <= abs(x) < 39/16", "positive argument", _arg_string] = @benchmarkable atan($(T(38/16)))
513+
g["19/16 <= abs(x) < 39/16", "negative argument", _arg_string] = @benchmarkable atan($(-T(38/16)))
514+
g["39/16 <= abs(x) < 2^66", "positive argument", _arg_string] = @benchmarkable atan($(T(50/16)))
515+
g["39/16 <= abs(x) < 2^66", "negative argument", _arg_string] = @benchmarkable atan($(-T(50/16)))
516+
end
490517
end # module

0 commit comments

Comments
 (0)