Skip to content

Commit 1082f7b

Browse files
committed
DO NOT MERGE, commit from PR JuliaLang#49568
1 parent 827d34a commit 1082f7b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

base/math.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ end
4646

4747
# non-type specific math functions
4848

49+
function two_mul(x::T, y::T) where {T<:Number}
50+
xy = x*y
51+
xy, fma(x, y, -xy)
52+
end
53+
4954
@assume_effects :consistent @inline function two_mul(x::Float64, y::Float64)
5055
if Core.Intrinsics.have_fma(Float64)
5156
xy = x*y

base/twiceprecision.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ julia> Float64(hi) + Float64(lo)
112112
```
113113
"""
114114
function mul12(x::T, y::T) where {T<:AbstractFloat}
115-
h = x * y
116-
ifelse(iszero(h) | !isfinite(h), (h, h), canonicalize2(h, fma(x, y, -h)))
115+
(h, l) = Base.Math.two_mul(x, y)
116+
ifelse(!isfinite(h), (h, h), (h, l))
117117
end
118118
mul12(x::T, y::T) where {T} = (p = x * y; (p, zero(p)))
119119
mul12(x, y) = mul12(promote(x, y)...)

0 commit comments

Comments
 (0)