29121, "damianmoz", "[Documentation]: Update Rationale for Imaginary types", "2026-07-13T22:35:21Z"
Here are some word that never quite made it into the documentation
Chapel supports distinct real and imaginary types to support
direct, efficient computation between real and/or imaginary
values without either (a) manually keeping track of which
floating-point values are real vs. imaginary or (b) promoting
everything to a complex value with a zero component. For
example, two imaginary values 'xi' and 'yi' can be multiplied
in Chapel, producing a real result rather than either (a) keeping
track that the input values are imaginary and the output is real
or (b) promoting the imaginary values to '0.0 + xi' and '0.0 + yi'
and doing the six floating-point operations required to multiply
them in that form. Including the imaginary type avoids numeric
instabilities and under-optimized code stemming from always
converting real values to complex values with a zero imaginary
part (or imaginary values to complex values with a zero real part).
One could write a multi-page document documenting the sound
mathematical reasons for an imaginary type but the above is more
than adequate to justify their inclusion for purely practical reasons.
They are not my words. They come from a private conversation with
Brad that deserve a wider audience.
Sorry, I do not know how to update the documentation. Also, they
probably need a last minute review before committal even given
their provenance. Thanks.