Skip to content

Commit

Permalink
more efficient use of muladd in evalpoly macro
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Apr 21, 2016
1 parent 09579e7 commit 413ffc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ macro evalpoly(z, p...)
ai = symbol("a", i)
push!(as, :($ai = $a))
a = :(muladd(r, $ai, $b))
b = :(muladd(-s, $ai, $(esc(p[i]))))
b = :($(esc(p[i])) - s * $ai) # don't have efficient multiply-subtract
end
ai = :a0
push!(as, :($ai = $a))
C = Expr(:block,
:(x = real(tt)),
:(y = imag(tt)),
:(r = x + x),
:(s = x*x + y*y),
:(s = muladd(x, x, y*y)),
as...,
:(muladd($ai, tt, $b)))
R = Expr(:macrocall, symbol("@horner"), :tt, map(esc, p)...)
Expand Down

0 comments on commit 413ffc7

Please sign in to comment.