bugGNU Octave - Bugs: bug #36587, datenum gives wrong result for...

 
 

bug #36587: datenum gives wrong result for int32 input.

Submitter:  None
Submitted:  Mon 04 Jun 2012 02:19:32 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guangliang He Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 05 Jun 2012 11:12:44 PM UTC, comment #4: 

It looks like the input checking for datenum should be stronger.  I've checked in a patch on the development branch that ensures that all the inputs are of class double (http://hg.savannah.gnu.org/hgweb/octave/rev/94a8366f9f89).  The fix will show up in version 3.8.0, or you can build from the development sources.

Rik <rik5>
Group administrator
Tue 05 Jun 2012 10:43:14 PM UTC, comment #3: 

Matlab 7.8.0 (R2009a) gives the following output:


>> datestr(datenum(int32(2012), int32(6), int32(1)))

??? Error using ==> datenum at 174
DATENUM failed.

Caused by:
    Error using ==> datenummx
    The datenummx function only accepts double arrays.
 

>> datestr(datenum(2012, 6, 1))

ans =
01-Jun-2012

>> x = datenum(int32(2012), int32(6), int32(1))

class (x)
??? Error using ==> datenum at 174
DATENUM failed.

Caused by:
    Error using ==> datenummx
    The datenummx function only accepts double arrays.

Randy <littlemanrkc>
Tue 05 Jun 2012 04:32:14 PM UTC, comment #2: 

Sorry I don't have matlab.

Anonymous
Mon 04 Jun 2012 05:03:02 PM UTC, comment #1: 

Can you verify that Matlab processes the two examples correctly?

In particular, what is the output of the following code under Matlab?


x = datenum(int32(2012), int32(6), int32(1))
class (x)



Rik <rik5>
Group administrator
Mon 04 Jun 2012 02:19:32 AM UTC, original submission:  

Here is the example:


> datestr(datenum(int32(2012), int32(6), int32(1)))
ans = 02-Jun-2011

> datestr(datenum(2012, 6, 1))
ans = 01-Jun-2012



Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by littlemanrkc (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-05 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2012-06-04 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code