diff --git a/base/math.jl b/base/math.jl index 0488d5530865c..3158e588723cb 100644 --- a/base/math.jl +++ b/base/math.jl @@ -393,6 +393,7 @@ function mod2pi(x::Int64) fx == x || throw(ArgumentError("Int64 argument to mod2pi is too large: $x")) mod2pi(fx) end +@vectorize_1arg Number mod2pi # generic fallback; for number types, promotion.jl does promotion muladd(x,y,z) = x*y+z diff --git a/test/mod2pi.jl b/test/mod2pi.jl index e240bc0b47648..2ad86fdac1779 100644 --- a/test/mod2pi.jl +++ b/test/mod2pi.jl @@ -194,3 +194,4 @@ testModPi() @test_approx_eq mod2pi(355.0f0) 3.1416228f0 @test mod2pi(Int64(2)^60) == mod2pi(2.0^60) @test_throws ArgumentError mod2pi(Int64(2)^60-1) +@test_approx_eq maximum(abs(mod2pi(testCases[:,1]).-testCases[:,2])) 0.0