std.complex MAY I REMIND YOU?

Matti Niemenmaa see_signature at for.real.address
Mon Feb 25 23:25:15 PST 2008


Bill Baxter wrote:
> Matti Niemenmaa wrote:
>> JMNorris wrote:
>>> Matti Niemenmaa <see_signature at for.real.address> wrote in
>>> news:fptoso$24mc$1 at digitalmars.com:
>>>> http://www.digitalmars.com/d/1.0/cppcomplex.html seems to be a good
>>>> summary.
>>> This is a good summary of the advantages of making complex a core 
>>> type.  I thought Walter was saying that compiler advances are erasing 
>>> those advantages, and that is why it complex numbers will no longer 
>>> be a core type.  But that is what I don't understand.
>>
>> Well, it appears to be all about optimization: everything else can be 
>> done in a library. Some "syntactical aesthetics" will be lost, but 
>> nothing else should be.
> 
> There's the bit from that Kahan guy about operations being handled 
> improperly too.  (1 - infinity*i) * i should be (infinity + i).  I'm not 
> sure how an optimizer is going to deal with that.  Seems like the only 
> way to deal with that is to de-optimize by introducing many conditionals 
> in complex math operations.  Or maybe he's just going to keep the pure 
> imaginary type.  A recent discussion made it sound like it was on the 
> way out too, but maybe not.

Just about everything on that page does refer to only the pure imaginary type, 
so one would think it is to be kept at least in some form. Or, as you say, some 
sort of flag or conditional against a zero real part.

>> So all it really takes is a compiler smart enough to optimize the 
>> operations on complex numbers, which I guess is what Walter meant when 
>> he mentioned "compiler advances" --- compilers these days are smarter, 
>> especially when it comes to optimization, than they used to be.
> 
> But the fact that smarter compilers exist does not magically make DMD 
> any smarter.

True, which is why it hasn't been done yet, as Walter said in 
fpsj89$2p0h$1 at digitalmars.com: "I want to remove the core complex types, but the 
necessary compiler optimizations aren't implemented yet, and there are more 
important things to be done at the moment."

 > Anyway, sounds like nothing's going to change for a while.

Agreed.

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list