complex number support
Iain Buclaw
ibuclaw at gdcproject.org
Wed Feb 4 17:53:03 UTC 2026
On Wednesday, 4 February 2026 at 17:15:49 UTC, Quirin Schroll
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.
>
> Having a built-in complex number types was a major selling
> point when I started looking into D ~10 years ago.
I did the benchmarks with GDC way back when. `std.complex` was
just as, or more performant than the built-in types - this can be
easily explained as many complex operations are not _actually_
supported in hardware, so become an opaque library call like
[__muldc3](https://compiler-explorer.com/z/nx5qEGnfs).
The only thing lost was ABI compatibility, hence the special enum
types that were added as the compromise.
More information about the Digitalmars-d
mailing list