|
From: | Patrick Häcker |
Subject: | [Octave-bug-tracker] [bug #33104] mat2str returns ugly result (different to Matlab) |
Date: | Sun, 17 Apr 2011 10:55:32 +0000 |
User-agent: | Mozilla/5.0 (compatible; Konqueror/4.4; de) KHTML/4.4.5 (like Gecko) |
URL: <http://savannah.gnu.org/bugs/?33104> Summary: mat2str returns ugly result (different to Matlab) Project: GNU Octave Submitted by: magicmuscleman Submitted on: So 17 Apr 2011 10:55:27 GMT Category: None Severity: 3 - Normal Priority: 5 - Normal Item Group: Incorrect Result Status: None Assigned to: None Originator Name: Originator Email: Open/Closed: Open Discussion Lock: Any Release: dev Operating System: GNU/Linux _______________________________________________________ Details: Matlab: mat2str(0.7) ans = 0.7 Octave: mat2str(0.7) ans = 0.69999999999999996 This behaviour is related with internal floating point representation, and the used precision: Octave: mat2str(0.5) ans = 0.5 According to Matlab's documentation (http://www.mathworks.com/help/techdoc/ref/mat2str.html), the precision's default is 15 digits. The attached patch sets the default accordingly and adds a test case to show the problem in the unpatched version and its solution in the patched version. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: So 17 Apr 2011 10:55:27 GMT Name: patch Size: 272B By: magicmuscleman <http://savannah.gnu.org/bugs/download.php?file_id=23263> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?33104> _______________________________________________ Nachricht geschickt von/durch Savannah http://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |