Displaying 2 results from an estimated 2 matches for "cxbyreal".
2024 Sep 05
0
BUG: atan(1i) / 5 = NaN+Infi ?
...re coerced to complex and the operation is carried out. I had assumed
this was documented in ?complex, but I don't see it there. Maybe it
should be.
If you want z/5 to be carried out using the correct mathematical
approach, you'll probably have to define it yourself. For example,
CxByReal <- function(num, denom) {
if (is.complex(denom)) stop("this is for a real denominator!")
complex(real = Re(num)/denom, imaginary = Im(num)/denom)
}
CxByReal(complex(real=0, imaginary=Inf), 5)
# [1] 0+Infi
Duncan Murdoch
>
> Sincerely,
>
> Leonard
>...
2024 Sep 05
3
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