[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59890] inf+1i*inf gives nan+1i*inf
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #59890] inf+1i*inf gives nan+1i*inf |
Date: |
Thu, 4 Feb 2021 12:07:38 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Follow-up Comment #8, bug #59890 (project octave):
To create -Inf+InfI in Octave, you can use
x = complex (-Inf, Inf)
Then exp (x) will produce 0. That is what the Fortran program is doing.
The following version is more like what Octave is doing:
program tstexp
double precision zero, one, inf
complex* 16 im, cval
zero = 0.0d0
one = 1.0d0
inf = one / zero
im = cmplx (zero, one)
cval = -inf + im*inf;
write(6,*) cval, exp(cval)
stop
end
We could fix the specific case of scalar multiplication of Inf and a complex
value with zero real (or imaginary) part. And we could use our own complex
class internally in Octave to fix more possible occurrences of these
multiplications for operations that are done directly in Octave code. But
that wouldn't fix things like
x = [i,2,3], y = Inf(3,1), x*y
where the multiplication is handled by a BLAS function and won't use our
overloaded class definition.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59890>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #59890] inf+1i*inf gives nan+1i*inf,
John W. Eaton <=