automatic Inf+NaN*i conversion

Ben Abbott bpabbott at mac.com
Fri Apr 25 17:45:47 CDT 2008


On Apr 25, 2008, at 12:42 PM, Jaroslav Hajek wrote:

> No, you are just plain wrong. As you have seen earlier, Inf+NaN*i  
> does not give
> complex(Inf, NaN), but rather complex(NaN, NaN), due to the fact that
> it is calculated as
> complex(Inf + 0*NaN, 0 + 1*NaN). The behaviour of isinf is OK - it
> gives infinity if either part of the complex number is Inf.

I thought I understood your point, but when I tested myself, the test  
did not meet my expectation :-(

Specifically, It appears to me that the two examples below are in  
contradiction.

octave:45> NaN*(1+0i) + Inf*(0+1i)
ans = NaN + Infi
octave:46> NaN*complex(1,0) + Inf*complex(0,1)
ans = NaN - NaNi

What is happening in this instance?

Ben




More information about the Bug-octave mailing list