-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add general fallback for rem2pi #52955
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
Conversation
Signed-off-by: 11happy <[email protected]>
|
Are the other methods (for |
like there's not much significant difference, Int32 just omits the condition. |
Co-authored-by: N5N3 <[email protected]>
|
The method for |
sure could do that , should I? |
Signed-off-by: 11happy <[email protected]>
I guess this is not a must. LLVM is clever enough to eliminate the error path. (So perhaps there's no need to keep the julia> function myrem2pi(x::Integer, r::RoundingMode)
fx = float(x)
fx == x || throw(ArgumentError(LazyString(typeof(x), " argument to rem2pi is too large: ", x)))
rem2pi(fx, r)
end
myrem2pi (generic function with 1 method)
julia> @code_llvm myrem2pi(Int32(1), RoundUp)
; Function Signature: myrem2pi(Int32, Base.Rounding.RoundingMode{:Up})
; @ REPL[1]:1 within `myrem2pi`
; Function Attrs: uwtable
define double @julia_myrem2pi_6707(i32 signext %"x::Int32") #0 {
L5:
; @ REPL[1]:2 within `myrem2pi`
; ┌ @ float.jl:356 within `float`
; │┌ @ float.jl:329 within `AbstractFloat`
; ││┌ @ float.jl:221 within `Float64`
%0 = sitofp i32 %"x::Int32" to double
; └└└
; @ REPL[1]:4 within `myrem2pi`
%1 = call double @j_rem2pi_6713(double %0)
ret double %1
} |
|
What about removing the |
|
@barucden That make sense to me. Perhaps we need some test to ensure there's no regression. |
Overview:
rem2pi(x::Integer, r::RoundingMode)is missing. #44715 by adding a general fallback.Testing:
Dependencies:
CC: