Why is complex being deprecated again?

Stewart Gordon smjg_1998 at yahoo.com
Mon Apr 16 07:12:28 PDT 2012


On 16/04/2012 12:42, Lars T. Kyllingstad wrote:
<snip>
>> Do you feel the SETI Institute should have given up years ago?
>
> I don't really see the similarity between SETI and Phobos.

They've been working for decades in the hope of finding aliens.  In the same way, 
imaginary types have been put into D in the hope that they would be useful.  To leap to 
the conclusion that they aren't useful, just because they haven't been put to any real use 
_yet_, would be like SETI leaping to the conclusion that aliens don't exist and therefore 
abandoning the project.

<snip>
>> This doesn't cover the case of multiplying a complex number by an imaginary number. In
>> the absence of imaginary types, one would have to use complex(-z.im * k, z.re * k), just
>> because z * complex(0, k) isn't guaranteed to produce the correct result.
>> Seems a bit silly. Or have you another suggestion for dealing with this?
>
> Yes: Define Complex!T so it produces the desired result in each case.
<snip>

You mean define complex multiplication and division with a special case so that, when ±0 
occurs as the real part of a number, it just pretends there's no real part at all?  I can 
see this slowing down almost any program that does complex arithmetic....

Stewart.


More information about the Digitalmars-d mailing list