octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: str2double behavior


From: Ben Abbott
Subject: Re: str2double behavior
Date: Mon, 06 Jun 2011 18:03:28 -0400

On Jun 6, 2011, at 5:46 PM, Rik wrote:

> One last question before I post a changeset for comments.
> 
> Does Matlab return a complex NaN or real NaN for unparseable inputs?
> 
> str2double ({ "abc"; "4i" })
> 
> returns
> 
>   NaN +   0i
>     0 +   4i
> 
> with the current 3.4.0 implementation.  It seems like it should be NaN +
> NaNi instead.  If Matlab returns NaN + NaNi, then are they being extra
> clever and narrowing results to real if the only complex values are NaN?
> 
> Test case is
> 
> str2double ({ "abc"; "4" })
> 
> 
> Thanks,
> Rik

I'm not sure what the proper interpretation is, but ...

>> str2double ({ 'abc'; '4i' })

ans =

                NaN                     
                  0 + 4.000000000000000i

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]