This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is -3.I (as opposed to 0-3.I) supposed evaluate to?


From: "Joseph S. Myers" <joseph@codesourcery.com>

On Mon, 8 Jun 2009, Kaveh R. GHAZI wrote:

If I write a complex double constant -3.I (as opposed to 0-3.I), what is
it supposed to evaluate to?  This program:

Because GCC does not implement imaginary types, this applies unary minus to 0.0+3.0I. Whereas 0-3.I means 0.0 - (0.0+3.0I), a mixed real/complex operation, the real part of whose result is 0.0 except when rounding towards negative infinity when it is -0.0. There are lots of tests in gcc.dg/torture/complex-sign*.

Okay thanks.


Perhaps the only safe way to create the value, even in the presence of rounding mode changes, is to use conj(3.I) ?

--Kaveh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]