www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - other (maybe silly) complex questions

reply dennis luehring <dl.soluz gmx.net> writes:
1. why can i write

template foo(U : int, int T : 10)
{
     U x = T;
}

but not

template foo(U : cfloat, cfloat T : 1 + 1i)
{
     U x = T;
}

2. is there an |z| or z.norm propertie or something?

3. how can i get the root(s) of complex numbers in d
(must i do it myself?)

4. will there be something like z.conj?

ciao dennis
Nov 20 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"dennis luehring" <dl.soluz gmx.net> wrote in message
news:dlq2hb$2nj2$1 digitaldaemon.com...
 1. why can i write

 template foo(U : int, int T : 10)
 {
      U x = T;
 }

 but not

 template foo(U : cfloat, cfloat T : 1 + 1i)
 {
      U x = T;
 }
You can do that now with 0.140.
 2. is there an |z| or z.norm propertie or something?
std.math.hypot should do it.
 3. how can i get the root(s) of complex numbers in d
 (must i do it myself?)
Currently, you'll have to do it yourself. If you want, you can contribute the result to Phobos.
 4. will there be something like z.conj?
Probably a good idea.
Nov 24 2005