You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
both multiply a complex variable z with a scalar (real) constant c.
Since c is an untyped real constant, mul1 can be implemented as mul2. However, the compiler appears to generate code for a full complex multiplication x * complex(c, 0) for mul1, leading both to slower multiplication and possibly a less accurate result.
NaN's really are a mistake. Posits wouldn't have this problem... :-(
I suppose we could specify (in the spec) that a real scalar multiplication of a complex number really is translated into element-wise multiplication, etc. But that would probably lead to other troubles.
These two functions
both multiply a complex variable
z
with a scalar (real) constantc
.Since c is an untyped real constant,
mul1
can be implemented asmul2
. However, the compiler appears to generate code for a full complex multiplicationx * complex(c, 0)
formul1
, leading both to slower multiplication and possibly a less accurate result.Assembly code for the two functions:
and
The compiler can easily statically determine that
c
has a 0 imaginary component and simplify the code generation.The text was updated successfully, but these errors were encountered: