|
202 | 202 | # generic signature also
|
203 | 203 | div(a::T, b::T, ::typeof(RoundToZero)) where {T<:Union{BitSigned, BitUnsigned64}} = div(a, b)
|
204 | 204 | div(a::Bool, b::Bool, r::RoundingMode) = div(a, b)
|
| 205 | +# Prevent ambiguities |
| 206 | +for rm in (RoundUp, RoundDown, RoundToZero) |
| 207 | + @eval div(a::Bool, b::Bool, r::$(typeof(rm))) = div(a, b) |
| 208 | +end |
| 209 | +function div(x::Bool, y::Bool, rnd::Union{typeof(RoundNearest), |
| 210 | + typeof(RoundNearestTiesAway), |
| 211 | + typeof(RoundNearestTiesUp)}) |
| 212 | + div(x, y) |
| 213 | +end |
205 | 214 | fld(a::T, b::T) where {T<:Union{Integer,AbstractFloat}} = div(a, b, RoundDown)
|
206 | 215 | cld(a::T, b::T) where {T<:Union{Integer,AbstractFloat}} = div(a, b, RoundUp)
|
| 216 | +div(a::Int128, b::Int128, ::typeof(RoundToZero)) = div(a, b) |
| 217 | +div(a::UInt128, b::UInt128, ::typeof(RoundToZero)) = div(a, b) |
| 218 | +rem(a::Int128, b::Int128, ::typeof(RoundToZero)) = rem(a, b) |
| 219 | +rem(a::UInt128, b::UInt128, ::typeof(RoundToZero)) = rem(a, b) |
207 | 220 |
|
208 | 221 | # These are kept for compatibility with external packages overriding fld/cld.
|
209 | 222 | # In 2.0, packages should extend div(a,b,r) instead, in which case, these can
|
|
0 commit comments