std.complex
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Nov 26 07:13:04 PST 2013
26-Nov-2013 09:06, Daniel Murphy пишет:
> "Dmitry Olshansky" <dmitry.olsh at gmail.com> wrote in message
> news:l6tfm8$2hnj$1 at digitalmars.com...
>>>
>>
>> Can't it just check for the real part being exactly zero and special- case
>> multiplication for that?
>>
>
> There is no such thing as exactly zero in floating point. Only -0 and +0.
Well, let it be magnitude, "exactly" implies as good zero test as we
need. I'm still of the opinion that a few predictable branches like
`if(rhs.re.isZero)` won't kill it.
Regardless, the point is that built-ins hardly help here at all as you
may just as well get an "exactly" 0+1i for some complex computation, and
the result won't suddenly change type to i{real,double,float}.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list