Complex numbers are harder to use than in C

Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 20 04:08:23 PST 2016


On Saturday, 19 November 2016 at 19:42:27 UTC, Marduk wrote:
> On Saturday, 19 November 2016 at 16:17:08 UTC, Meta wrote:
>> On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote:
>>> [...]
>>
>> D used to support complex numbers in the language (actually it 
>> still does, they're just deprecated). This code should compile 
>> with any D compiler:
>>
>> cdouble[2][2] a = [[0 + 1i, 0], [0, 0 + 1i]];
>
> Thank you! However, I am concerned that if this is deprecated, 
> then I should not use it (it is not future-proof). I wonder why 
> D dropped this syntax for complex numbers. It is very handy.

You can use builtin complex numbers (cfloat/cdouble/creal). The 
idea of std.complex is wrong . Mir GLAS uses builtin complex 
numbers and I don't think they will be really deprecated. --Ilya


More information about the Digitalmars-d-learn mailing list