[R] BUG: atan(1i) / 5 = NaN+Infi ?
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Fri Sep 13 19:10:16 CEST 2024
On 2024-09-13 8:53 a.m., Jonathan Dushoff wrote:
>> Message: 4
>> Date: Thu, 12 Sep 2024 11:21:02 -0400
>> From: Duncan Murdoch <murdoch.duncan using gmail.com>
>> That's not the correct formula, is it? I think the result should be x *
>> Conj(y) / Mod(y)^2 .
>
> Correct, sorry. And thanks.
>
>> So that would involve <double> * <complex> and
>> <complex> / <double>, not just real arithmetic.
>
> Not an expert, but I don't see it. Conj and Mod seem to be numerically
> straightforward real-like operations. We do those, and then multiply
> one complex number by one real quotient.
>
Are you sure? We aren't dealing with real numbers and complex numbers
here, we're dealing with those sets extended with infinities and other
weird things.
I think the formula I gave assumes no infinities.
So for example if y is some kind of infinite complex number, then 1/y
should come out to zero, and if x is finite, the final result of x/y
should be zero.
But if we evaluate x/y as (x / Mod(y)^2) * Conj(y), won't we get a NaN
from zero times infinity?
I imagine someone has thought about all these edge cases. Maybe they're
discussed in one of the standards that Richard referenced.
Duncan Murdoch
More information about the R-help
mailing list