View mode: basic / threaded / horizontal-split · Log in · Help
November 20, 2005
other (maybe silly) complex questions
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
November 25, 2005
Re: other (maybe silly) complex questions
"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.
Top | Discussion index | About this forum | D home