bugGNU Octave - Bugs: bug #43753, datevec returns negative dates...

 
 

bug #43753: datevec returns negative dates with integer datenum

Submitted by:  None
Submitted on:  Thu 04 Dec 2014 03:30:23 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Nir KrakauerOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.2
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 05 Dec 2014 08:39:20 PM UTC, comment #4:

I applied Nir's patch to the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/7d272300a880). I made one change which was to cast the input to double before taking the floor and subtracting 60.

This handles exceptional inputs like uint8(1) which can't handle negative numbers.

Closing report.

Rik <rik5>
Project Administrator
Fri 05 Dec 2014 12:55:16 PM UTC, comment #3:

A more elegant demonstration of the problem is

Following on Avinoam's suggestions, I prepared a simple change that fixes and tests for these problems, attached.

(file #32599, file #32600)

Nir Krakauer <nir_krakauer>
Thu 04 Dec 2014 08:58:30 PM UTC, comment #2:

Hi,

Maybe a better solution is to use another variable for double(date):

Avinoam

Avinoam Kalma <avinoam>
Project Member
Thu 04 Dec 2014 08:54:26 PM UTC, comment #1:

H,

Adding the line

before the line

in file Octave-3.8.2\share\octave\3.8.2\m\time\datevec.m
should solve this problem

Avinoam

Avinoam Kalma <avinoam>
Project Member
Thu 04 Dec 2014 03:30:23 PM UTC, original submission:

As an example,

returns, as expected

but the result with

is

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32599:  datevec.m added by nir_krakauer (11KiB - text/x-objcsrc)
file #32600:  datevec.patch added by nir_krakauer (836B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by nir_krakauer (Updated the item)
  • -unavailable- added by avinoam (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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 05 Dec 2014 08:39:20 PM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Fri 05 Dec 2014 01:47:49 PM UTCjweStatusNone=>Patch Submitted
    Fri 05 Dec 2014 12:55:16 PM UTCnir_krakauerAttached File-=>Added datevec.m, #32599
      Attached File-=>Added datevec.patch, #32600

    Back to the top


    Powered by Savane 3.1-cleanup1