bugGNU Octave - Bugs: bug #41286, datestr() returns wrong results if...

 
 

bug #41286: datestr() returns wrong results if one of input params is int32

Submitted by:  Elmar Leson <el77>
Submitted on:  Mon 20 Jan 2014 02:33:15 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: InvalidAssigned to: None
Originator Name: el77Open/Closed: Closed
Release: 3.6.4Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 20 Jan 2014 07:50:29 PM UTC, comment #1:

Thanks for your report. However, I'm marking this as invalid because the date functions have been intentionally modified to only accept double arguments. In particular, your example in Octave 3.8.0 now shows:

So that pushes the issue back on the caller to make sure the arguments are of the correct type. This was fixed for Matlab compatibility, see bug #36587.

If you can show that this is not Matlab compatible behavior, please follow up to this report and I'll reopen, but it looks like Octave 3.8.0 is now doing the right thing in this case.

Mike Miller <mtmiller>
Project Administrator
Mon 20 Jan 2014 02:33:15 PM UTC, original submission:

I got wrong results with datestr(). Was hard to find, because the input date of datest() was generated by datenum(). But if one of the input parameters of datenum() is of int32 format, the function returns int32. That doesn't work with datestr().

dat = datenum(2014,01,20)
datestr(dat,29)

> 2014-01-20


works correctly. But
dat = datenum(int32(2014),01,20) or
dat = datenum(2014,int32(01),20) or
dat = datenum(2014,01,int32(20))
datestr(dat,29)

> 2014-02--9 % day is negative!!!

is out of range.

My request: datestr must work with all integer formats.

Current workaround:
datestr(double(dat),29)

Elmar Leson <el77>

 

(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 mtmiller (Posted a comment)
  • -unavailable- added by el77 (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Jan 2014 07:50:29 PM UTCmtmillerItem GroupIncorrect Result=>Matlab Compatibility
      StatusNone=>Invalid
      Open/ClosedOpen=>Closed
      Operating SystemMicrosoft Windows=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1