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

 
 

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

Submitted by:  None
Submitted on:  Mon 04 Jun 2012 02:19:32 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Guangliang HeOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.1
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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?

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

Here is the example:

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 05 Jun 2012 11:12:44 PM UTCrik5StatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Mon 04 Jun 2012 10:55:00 PM UTCrik5StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1