Wht std.complex is needed?

Don nospam at nospam.com
Mon Apr 6 03:27:43 PDT 2009


bearophile wrote:
> Sam Hu:
>> Doesn't  D already has the built-in types cfloat, cdouble, creal, ifloat, idouble, and ireal?What's the advantage having complex class instead?

The intention is that cfloat, cdouble,... will be deprecated eventually.

I don't think std.complex should be part of Phobos yet, it needs some 
major work -- in particular, polar coordinates are just asking for 
trouble, especially as currently implemented. The angle 'arg' needs to 
be fixed point, otherwise you get a roundoff nightmare.
Even assert(z == - (-z)) can fail!

> 
> Some people have discussed/complained that complex types aren't worth being built-ins, so the *struct* Complex of std.complex of D2 will replace them. (I am not sure such complex struct is as good as the current built-ins, but it seems most D1 users don't use complex numbers much, so they don't care).
> 
> Bye,
> bearophile


More information about the Digitalmars-d-learn mailing list