At least as of julia v1.0, floor(x) has fallen back to round(x, RoundDown).
Starting with julia v0.11, floor(T, x) has also been made to fall back to round(T, x, RoundDown).(cf. JuliaLang/julia#45598)
Therefore, it should be sufficient to define only round(x, ::RoundingMode) and round(T, x, ::RoundingMode) in FPN.
Conversely, starting with Julia v0.11, defining methods such as floor(T, x) may carry a higher risk of invalidation.
(As efforts related to TTFX within the Julia ecosystem are also advancing, it is unclear what impact this will have on actual performance.)
Of course, invalidation triggered by the 2-/3-arg round is, in principle, unavoidable.
However, I think it can be effective if the invalidation results from the casual (type-instable) use of functions like floor.
Since rounding functions like floor are expected to be inlined when there is no risk of overflow/underflow (e.g., ceil(typemax(Q0f7))), I don't think there will be much of a performance penalty.
It’s fragile against piracy and future changes to Base implementation, but I’m sure someone will notice and fix it.
At least as of julia v1.0,
floor(x)has fallen back toround(x, RoundDown).Starting with julia v0.11,
floor(T, x)has also been made to fall back toround(T, x, RoundDown).(cf. JuliaLang/julia#45598)Therefore, it should be sufficient to define only
round(x, ::RoundingMode)andround(T, x, ::RoundingMode)in FPN.Conversely, starting with Julia v0.11, defining methods such as
floor(T, x)may carry a higher risk of invalidation.(As efforts related to TTFX within the Julia ecosystem are also advancing, it is unclear what impact this will have on actual performance.)
Of course, invalidation triggered by the 2-/3-arg
roundis, in principle, unavoidable.However, I think it can be effective if the invalidation results from the casual (type-instable) use of functions like
floor.Since rounding functions like
floorare expected to be inlined when there is no risk of overflow/underflow (e.g.,ceil(typemax(Q0f7))), I don't think there will be much of a performance penalty.It’s fragile against piracy and future changes to
Baseimplementation, but I’m sure someone will notice and fix it.