HP Forums
Odd date calc on 20b - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Odd date calc on 20b (/thread-139671.html)



Odd date calc on 20b - Darin Murphy - 08-08-2008

While playing with my new 20b, I noticed something odd about the days between dates calculation. Try this and see what you get:

Date 1: 6.252003

Date 2: 12.312010

Actual days: 2746


Now switch to cal 360 and evaluate: -721,255 is what it shows on mine.

However, on both the 17BII+silver and 12c 25th ann. ed. the same calculations give these answers:

17BII+: Acutal days 2746

360 days 2706

12c: 2746

after pressing x<>y swap button it gives 2706


Re: Odd date calc on 20b - cyrille de Brébisson - 08-08-2008

Hello,

so, do you know how they handle the 'day index' for a 'bad' date for the 360 calendar but a good date for the actual calendar (the only way it can happen is for the 31th of a month)...

it looks like they just take the 'day index' for day 30 of that month and then add 1... can yo confirm?

cyrille


Re: Odd date calc on 20b - Darin Murphy - 08-09-2008

Yes I believe that is what happens. When using 12/30 for 30 day calendar it returns 2,705. What does the 20b do instead when switching from actual to cal 360?


Re: Odd date calc on 20b - Katie Wasserman - 08-09-2008

Quote:
so, do you know how they handle the 'day index' for a 'bad' date for the 360 calendar but a good date for the actual calendar (the only way it can happen is for the 31th of a month)...

All you need to do is look at the appendix of the 12C manual, all the date calculation arithmetic is there.


Edited: 9 Aug 2008, 12:47 p.m.


Re: Odd date calc on 20b - cyrille de Brébisson - 08-09-2008

hello,

Quote:
Yes I believe that is what happens. When using 12/30 for 30 day calendar it returns 2,705. What does the 20b do instead when switching from actual to cal 360?

all calculations on dates are done in 360 mode, it creates a numerical index from the date using the following formula: 360*year+30*(month-1)+day-1.
when a date is invalid, it returns -1 or 0xffffffff.
since the day between function is baddly codded and does not check the return validity, it will return index from date 1 - 0xffffff therefore the change result.

cyrille