From: "Joseph S. Myers" <jos...@codesourcery.com>
On Mon, 8 Jun 2009, Kaveh R. Ghazi wrote:
Perhaps the only safe way to create the value, even in the presence of
rounding mode changes, is to use conj(3.I) ?
Setting the __real__ and __imag__ parts of a temporary variable should
always be reliable for making a complex number out of arbitrary real and
imaginary parts.
Well yes, but I meant for compile-time expressions that are exposed to fold
even at -O0. (Recall that I'm writing testcases for the MPC stuff.) I'm
not 100% confident that the temporary variable will always fold and it's too
verbose when repeatedly used in a testcase. With conj, the builtin will
always fold 3.I and won't do anything unexpected with rounding modes.
I was just wondering why -3.I was evaluating differently than 0-3.I and
whether it was a bug. Your explanation was very useful.
Thanks,
--Kaveh