complex number support

Quirin Schroll qs.il.paperinik at gmail.com
Wed Feb 4 17:19:36 UTC 2026


On Wednesday, 4 February 2026 at 16:58:42 UTC, Iain Buclaw wrote:
> On Wednesday, 4 February 2026 at 05:14:52 UTC, Walter Bright 
> wrote:
>> It's becoming clear that I cannot avoid supporting complex 
>> numbers in the code generator for AArch64:
>>
>> 1. deprecating creal and use std.complex instead doesn't help 
>> since we need to support old code
>>
>> 2. C has complex real and imaginary real types, which need to 
>> be supported as well.
>>
>> I'm giving up and am just going to support complex types in 
>> the code generator.
>
> I've mentioned this before.  I might be open to reintroducing 
> complex into the language as `__complex(float)` et al. so that 
> it falls into the specialized category of types that aren't 
> guaranteed to always be supported (whilst at the same time 
> freeing up the old keywords to use as an identifier)
>
> We already have the means to test whether `__vector(T)` is 
> supported on a given target, the same style hooks can be used 
> for `__complex(T)`.

Please don’t miss `__imaginary`.

It wouldn’t be too terrible if object.d had this:
```d
version(ImaginarySupport)
{
     alias ifloat  = __imaginary(float);
     alias idouble = __imaginary(double);
     alias ireal   = __imaginary(real);
}
version(ComplexSupport)
{
     alias cfloat  = __complex(float);
     alias cdouble = __complex(double);
     alias creal   = __complex(real);
}
```


More information about the Digitalmars-d mailing list