Skip to content

Commit

Permalink
redirect muladd for BigFloat to fma (#49401)
Browse files Browse the repository at this point in the history
A fused multiply-add is available in MPFR as `mpfr_fma` and `Base.fma`
already uses it. Apart from being fused (more accurate), it's also more
performant than the generic `muladd` and allocates one less temporary
`BigFloat`.
  • Loading branch information
nsajko authored Apr 19, 2023
1 parent 1c6271f commit 2eea585
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export

import
.Base: *, +, -, /, <, <=, ==, >, >=, ^, ceil, cmp, convert, copysign, div,
inv, exp, exp2, exponent, factorial, floor, fma, hypot, isinteger,
inv, exp, exp2, exponent, factorial, floor, fma, muladd, hypot, isinteger,
isfinite, isinf, isnan, ldexp, log, log2, log10, max, min, mod, modf,
nextfloat, prevfloat, promote_rule, rem, rem2pi, round, show, float,
sum, sqrt, string, print, trunc, precision, _precision, exp10, expm1, log1p,
Expand Down Expand Up @@ -536,6 +536,8 @@ function fma(x::BigFloat, y::BigFloat, z::BigFloat)
return r
end

muladd(x::BigFloat, y::BigFloat, z::BigFloat) = fma(x, y, z)

# div
# BigFloat
function div(x::BigFloat, y::BigFloat)
Expand Down

0 comments on commit 2eea585

Please sign in to comment.