std.complex
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Tue Nov 26 00:35:46 PST 2013
On 23/11/13 08:43, Ali Çehreli wrote:
> import std.stdio;
> import std.complex;
>
> void main()
> {
> writeln(complex(1.0L, -real.infinity) * complex(0.0, 1.0L));
> writeln((1L - ireal.infinity) * 1i);
> }
>
>
> The output:
>
> inf-nani <-- "incorrect" according to the quoted page
> inf+1i <-- correct
But, still operating with builtins,
writeln((1L - ireal.infinity) * (0 + 1i));
and you get again
inf-nani
Basically, your nice result with (1L - ireal.infinity) * 1i comes about because
in this case, you're not multiplying two complex numbers, but one complex and
one imaginary. In the latter case, there's no 0 to multiply by infinity.
More information about the Digitalmars-d
mailing list