julia
9d896dc9 - Throw OverflowError on `copysign(typemin(Int)//1, 1)` (#53395)

Commit
1 year ago
Throw OverflowError on `copysign(typemin(Int)//1, 1)` (#53395) The default `copysign(x::Real, y::Real)` in `number.jl` works, so the incorrect method in `rational.jl` isn't needed. Here is a benchmark of the new version. ```julia using BenchmarkTools function foo!(c,a,b) c .= copysign.(a, b) nothing end N = 1000 @btime foo!(c,a,b) setup=(c=zeros(Rational{Int},N); a=rand(Int,N).//rand(Int,N); b=fill(-1,N)) ``` On master: 406.215 ns (0 allocations: 0 bytes) On this PR: 869.327 ns (0 allocations: 0 bytes)
Author
Parents
Loading