octave-maintainers
[Top][All Lists]
Advanced

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

Re: Question about str2double


From: Ben Abbott
Subject: Re: Question about str2double
Date: Mon, 31 Oct 2011 13:31:15 -0400

On Oct 31, 2011, at 7:19 AM, Ben Abbott wrote:

> On Oct 30, 2011, at 10:26 AM, PhilipNienhuis <address@hidden> wrote:
> 
>> octave:11> str2double ('1 2 3 4')
>> ans =  1234
>> 
>> Is it intended behaviour that str2double ignores spaces?
> 
> Matlab returns NaN. Octave's behavior appears to be buggy. 
> 
> Ben

I ran some comparative speed tests. A good example was ...

        tic; for n = 1:1e6; a = str2double ('1+1i'); end; tic

In this test, Octave is about 7x faster than Matlab.

Perhaps Octave's unexpected behavior is feature of its improved performance?

Ben

p.s. I took a quick look at str2double.cc but since c/c++ is a big weakness for 
me I can't tell if this unexpected behavior can be fixed without slowing things 
down.


reply via email to

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