octave-bug-tracker
[Top][All Lists]
Advanced

[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: Sun, 01 Sep 2013 10:40:18 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

Follow-up Comment #8, bug #39838 (project octave):

Thanks, I'll try tonight or Tuesday (my boxes are occupied with other builds
now). I'll also try to add a few more tests. 

Your name is not in contributors.in
(http://hg.savannah.gnu.org/hgweb/octave/file/95412dcfa707/doc/interpreter/contributors.in)
- would you like to be added? (few people object). How would you like to be
attributed in the final changeset (see
http://hg.savannah.gnu.org/hgweb/octave, pick a log entry and see how it looks
like in the "author:" line), OR:
Better yet (for me ;-) ) can you prepare a changeset rather than a diff patch,
including the revised help text?


As to char array input:
- Again, note that Matlab simply doesn't mention char array input for
str2double. That was already so for r2007a (oldest version I have tried). If
absurd, it must be that it doesn't  immediately warn when trying to process a
char array, but only when it gets really unparsable. See below for r2007a
output:


>> str2double (['1'; ''; '2'])
ans =
    12   
% No mention of erroneous input!
>> str2double (['1'; ' '; '2'])
??? Error using ==> strrep
Input strings must have one row.
Error in ==> str2double at 44
    s = strrep(s, ',','');


(...where it shows in passing that ML deletes commas while processing strings.
BTW an interesting outcome for bug #34713)

- Yes, char arrays are normally padded to equal string element (row) length
(by Octave, internally). My point -again- is that str2double's input can be
generated by other procedures or scripts [1], even outside Octave, that are
unaware of this, so we simply have to be prepared for those procedures to
generate empty elements in char arrays. If not technically (while processing)
then at least 'verbally' (by warning users that output may be smaller in size
than expected).

[1] I cannot easily come up with an example of how to do that in practice, but
I have no doubts that it is possible.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39838>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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