[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39838] str2double ('') gives [](0x1) instead
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #39838] str2double ('') gives [](0x1) instead of NaN |
Date: |
Wed, 21 Aug 2013 13:14:50 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 |
URL:
<http://savannah.gnu.org/bugs/?39838>
Summary: str2double ('') gives [](0x1) instead of NaN
Project: GNU Octave
Submitted by: philipnienhuis
Submitted on: Wed 21 Aug 2013 03:14:49 PM CEST
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Philip Nienhuis
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
According to the Octave docs, str2double(S) "...returns NaN for elements of S
which cannot be converted".
However, in Octave 3.7.5 (and I also saw this in Octave 3.4.3):
debug> str2double('')
ans = [](0x1)
debug> str2double([])
ans = [](0x0)
debug> str2double(' ')
ans = NaN
debug> str2double('a')
ans = NaN
debug> str2double({})
ans = [](0x0)
debug> str2double({''})
ans = NaN
debug> str2double({[]})
ans = NaN
debug>
...so str2double doesn't always behave as the docs say it does.
(Note I hit this while debugging Matlab scripts at work)
Matlab r2012a gives: (empty lines removed)
>> str2double('')
ans =
NaN
>> str2double([])
ans =
NaN
>> str2double(' ')
ans =
NaN
>> str2double('a')
ans =
NaN
>> str2double({})
ans =
[]
>> str2double({''})
ans =
NaN
>> str2double({[]})
ans =
NaN
>>
...so also Matlab sometimes gets confused, e.g., str2double({}) (Matlab docs
claim it should return NaN there, in wording similar to Octave)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39838>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #39838] str2double ('') gives [](0x1) instead of NaN,
Philip Nienhuis <=