24-Nov-2013 22:03, Shammah Chancellor пишет:
On 2013-11-24 18:00:45 +0000, Andrei Alexandrescu said:

On 11/24/13 9:54 AM, Joseph Rushton Wakeling wrote:
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

It's because 0.0L * (-real.infinity) evaluates to nan.

Has this been submitted as a bug report?

Andrei

It's more a fundamental problem with a complex type in general.   C++
has this issue as well.   You need a purely imaginary type with the
appropiate operations between Complex and Imaginary defined.


Can't it just check for the real part being exactly zero and special- case multiplication for that?

--
Dmitry Olshansky

Reply via email to