[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45174] numstr produces differently sized resu
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #45174] numstr produces differently sized results from Matlab for some corner cases |
Date: |
Sun, 24 May 2015 04:58:20 +0000 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1) |
URL:
<http://savannah.gnu.org/bugs/?45174>
Summary: numstr produces differently sized results from
Matlab for some corner cases
Project: GNU Octave
Submitted by: rik5
Submitted on: Sat 23 May 2015 09:58:19 PM PDT
Category: Octave Function
Severity: 2 - Minor
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
Corner case 1 : %s on integer values
This is supposed to produce a string where the integers are interpreted as
ASCII characters as long as they are in the appropriate range. Octave almost
succeeds, but truncates the string by one character.
octave:1> num2str ([65 66 67], '%c')
ans = ABC
octave:2> num2str ([65 66 67], '%s')
ans = AB
Corner case 2 : wrong conversion for type of numeric input, should default to
'%e'
If you use an incorrect format, Octave is supposed to recognize that the data
is not correct and switch to the '%e' format. For example,
octave:3> num2str (e, '%s')
ans =
The answer should be
octave:4> num2str (e, '%e')
ans = 2.718282e+00
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45174>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #45174] numstr produces differently sized results from Matlab for some corner cases,
Rik <=