std.complex
Shammah Chancellor
anonymous at coward.com
Sun Nov 24 10:03:04 PST 2013
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.
More information about the Digitalmars-d
mailing list