[R] BUG: atan(1i) / 5 = NaN+Infi ?
Leo Mada
|eo@m@d@ @end|ng |rom @yon|c@eu
Fri Sep 6 00:20:20 CEST 2024
Dear Bert,
These behave like real divisions/multiplications:
complex(re=Inf, im = Inf) * 5
# Inf+Infi
complex(re=-Inf, im = Inf) * 5
# -Inf+Infi
The real division / multiplication should be faster and also is well behaved. I was expecting R to do the real division/multiplication on a complex number. Which R actually does for these very particular cases; but not when only Im(x) is Inf.
Sincerely,
Leonard
________________________________
From: Bert Gunter <bgunter.4567 using gmail.com>
Sent: Friday, September 6, 2024 1:12 AM
To: Duncan Murdoch <murdoch.duncan using gmail.com>
Cc: Leo Mada <leo.mada using syonic.eu>; r-help using r-project.org <r-help using r-project.org>
Subject: Re: [R] BUG: atan(1i) / 5 = NaN+Infi ?
Perhaps
> Inf*1i
[1] NaN+Infi
clarifies why it is *not* a bug.
(Boy, did that jog some long dusty math memories :-) )
-- Bert
On Thu, Sep 5, 2024 at 2:48 PM Duncan Murdoch <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>> wrote:
On 2024-09-05 4:23 p.m., Leo Mada via R-help wrote:
> Dear R Users,
>
> Is this desired behaviour?
> I presume it's a bug.
>
> atan(1i)
> # 0+Infi
>
> tan(atan(1i))
> # 0+1i
>
> atan(1i) / 5
> # NaN+Infi
There's no need to involve atan() and tan() in this:
> (0+Inf*1i)/5
[1] NaN+Infi
Why do you think this is a bug?
Duncan Murdoch
______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help
mailing list