std.complex MAY I REMIND YOU?

Bill Baxter dnewsgroup at billbaxter.com
Mon Feb 25 12:13:26 PST 2008


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.

> 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.  I suspect "compiler advances" are mostly the result of 
throwing lots of engineering time at the problem, analyzing piles of 
test cases, comparing generated code with ideal assembly code, and 
figuring out transformation rules that can be used to get closer to that 
ideal assembly.  I.e. not theoretical breakthroughs, but just plain hard 
work.

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

--bb



More information about the Digitalmars-d mailing list