Complex number syntax

Stewart Gordon smjg_1998 at yahoo.com
Mon Nov 12 07:28:59 PST 2007


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:fh77bs$295e$1 at digitalmars.com...
<snip>
>  cfloat[8] data2;
>  foreach(int n, ref d; data2) {
>    // d.re = -n-5; // not possible?
>    // d.im = n-5; // not possible?

These ought to work.

>    // d = (-n-5, n-5); // not possible

Because (-n-5, n-5) is a comma expression.  It evaluates -n-5, and then 
evaulates and returns n-5.

>    // d = -n-5 + (n-5) i; // not possible

Because i isn't a keyword, it's a literal suffix.

>    // d = cast(cfloat)(-n-5, n-5); // not possible
<snip>

See above.

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 



More information about the Digitalmars-d-learn mailing list