[phobos] Is anyone working on std.complex?

Lars Tandle Kyllingstad lars at kyllingen.net
Fri Mar 26 10:12:50 PDT 2010


Andrei Alexandrescu wrote:
> 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.

Yeah, it took a while before I realised I hadn't.


> Looks like a good start. A few comments:
> 
> * Instead of R, you may want to remove it and use FPTemporary defined in 
> std.numeric

I didn't know such a thing existed.  That's very clever!


> * Use auto instead of T when you can, e.g.:
> 
> T absRe = abs(re);
> 
> should be
> 
> auto absRe = abs(re);

Ok.


> 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.

I agree.


> * All opOpAssign should return ref Complex, not Complex

I learn something new every day. :)

-Lars



More information about the phobos mailing list