[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60671] Wrong result when subtracting one mont
From: |
Georg Wiora |
Subject: |
[Octave-bug-tracker] [bug #60671] Wrong result when subtracting one month from 31-MON-YEAR date |
Date: |
Tue, 25 May 2021 12:10:37 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0 |
Follow-up Comment #4, bug #60671 (project octave):
I don't see the necessity of loops here. eomday does allready calculate the
last of month. Could you please post your fix as a complete file?
Here is the excerpt from my fix (see full file in attachments)
## adjust the years and months if the date rolls over a year
dtmp(:,1) += floor ((dtmp(:,2)-1)/12);
dtmp(:,2) = mod (dtmp(:,2)-1, 12) + 1;
# BUGFIX gwiora: Avoid days beyond end of month
beyondEOM = dtmp(:,3)>eomday(dtmp(:,1),dtmp(:,2));
dtmp(beyondEOM,3) = eomday(dtmp(beyondEOM,1),dtmp(beyondEOM,2));
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60671>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/