[phobos] Is anyone working on std.complex?

Andrei Alexandrescu andrei at erdani.com
Fri Mar 26 07:17:43 PDT 2010


On 03/26/2010 09:02 AM, Lars Tandle Kyllingstad wrote:
> Here's a start:
>
> http://github.com/kyllingstad/ltk/blob/master/ltk/complex.d
>
> Would this be usable?
>
> -Lars

I assume you meant to send this to the list, so I'm adding it now.

Looks like a good start. A few comments:

* Instead of R, you may want to remove it and use FPTemporary defined in 
std.numeric

* Use auto instead of T when you can, e.g.:

T absRe = abs(re);

should be

auto absRe = abs(re);

Probably using auto throughout may even obviate the need for FPTemporary 
(I defer to Don).

* Some asserts before division by zero would be helpful. Carrying 
through with silent NaNs annoy the heck out of anyone.

* All opOpAssign should return ref Complex, not Complex

Thanks for your work!


Andrei


More information about the phobos mailing list