|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #50673] datestr truncates fractional minutes rather than rounding |
Date: | Wed, 29 Mar 2017 16:47:42 -0400 (EDT) |
User-agent: | Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Update of bug #50673 (project octave): Item Group: None => Matlab Compatibility Status: None => Need Info Release: 4.0.3 => dev Summary: 'datestr' gives wrong result. Possibly a rounding issue => datestr truncates fractional minutes rather than rounding _______________________________________________________ Follow-up Comment #1: Definitely looks like rounding. datenum() calculates in days. See below where I calculate the expected difference in minutes. octave:18> format long octave:19> etime = datenum ('1:00') - datenum ('0:55') etime = 0.00347222213167697 octave:20> minutes = etime * 24 * 60 minutes = 4.99999986961484 So the question is whether datestr should use round or whether it should simply truncate the fractional part of minutes. The current behavior is to truncate as shown below. octave:23> datestr (4.9/60/24) ans = 12:04 AM octave:24> datestr (4.1/60/24) ans = 12:04 AM One way to resolve this would be to test the equivalent code in Matlab. If they truncate results then Octave should too. If they round results then Octave should too. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?50673> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |