I hate having to ask this because I assume the answer must be simple, but I cannot for the life of me seem to track down the source. While trying to rewrite a function I ran across this problem:
a = -j
x = real(a)
y = imag(a)
y/x
Which spits out Inf
, unexpectedly for me. However...
a = 0
b = -1
b/a
returns -Inf
, like I would expect. Inquiring further, a == x
, b == y
. Clearly that isn't true however. I finally tracked down the problem to this after a lot of frustration. If the original input for a
is instead 0-j
(vs. -j
) then there is no problem.
Both real(-j)
and real(0-j)
return zero and test as zero, but obviously seem to retain some metadata relating to their origin that I absolutely cannot discover. What precisely am I missing here? It will feel downright wrong if I have to solve this with something like if (x == 0) then x = 0;