julia
b998f53b - Use `roundeven` instead of `rint` for `round(x)`

Commit
3 years ago
Use `roundeven` instead of `rint` for `round(x)` The `llvm.rint` intrinsic is sensitive to the floating-point environment, so determined enough users can change the definition of `round(x, RoundNearest)` to not be rount to even. ``` julia> round(2.5, RoundNearest) 2.0 julia> Base.Rounding.setrounding_raw(Float64, Base.Rounding.to_fenv(RoundUp)) julia> round(2.5, RoundNearest) 3.0 julia> round_even(x::Float64) = ccall("llvm.roundeven.f64", llvmcall, Float64, (Float64,), x) round_even (generic function with 1 method) julia> round_even(2.5) 2.0 ```
Author
Committer
Parents
Loading