[R] BUG: atan(1i) / 5 = NaN+Infi ?

Leo Mada |eo@m@d@ @end|ng |rom @yon|c@eu
Fri Sep 6 00:12:43 CEST 2024


Dear Duncan,

Here is also the missing information:
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Regarding the results:
atan(1i)
# 0+Infi
Re(atan(1i))
# 0
Im(atan(1i))
#  Inf

0 + Inf i is a valid complex number:
tan(atan(1i))
# 0+1i

Inf / 5
# Inf

Note: atan(1i) / 5 should have generated 0 + Inf * 1i; even the explicit complex number fails:
complex(re=0, im = Inf) / 5
# NaN+Infi
complex(re=Inf, im = Inf) / 5
# Inf+Infi

I presume that R tries to do the complex division, although the real division is well defined.

Sincerely,

Leonard

________________________________
From: Duncan Murdoch <murdoch.duncan using gmail.com>
Sent: Friday, September 6, 2024 12:40 AM
To: 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 ?

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?iso-8859-7?Q?5-(2019)-CEBP=E2-LIP_induces_cancer-type_metabolic_reprogr?= =?iso-8859-7?Q?amming_by_regulating_the_let-7LIN28B_circuit_in_mice.pdf?=
Type: application/pdf
Size: 2136921 bytes
Desc: =?iso-8859-7?Q?5-(2019)-CEBP=E2-LIP_induces_cancer-type_metabolic_reprogr?= =?iso-8859-7?Q?amming_by_regulating_the_let-7LIN28B_circuit_in_mice.pdf?=
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20240905/85b49427/attachment-0001.pdf>


More information about the R-help mailing list