The Museum of HP Calculators

HP Forum Archive 18

 Odd date calc on 20bMessage #1 Posted by Darin Murphy on 8 Aug 2008, 6:43 p.m. 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 20bMessage #2 Posted by cyrille de Brébisson on 8 Aug 2008, 11:10 p.m.,in response to message #1 by Darin Murphy 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 20bMessage #3 Posted by Darin Murphy on 9 Aug 2008, 11:06 a.m.,in response to message #2 by cyrille de Brébisson 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 20bMessage #4 Posted by cyrille de Brébisson on 9 Aug 2008, 5:13 p.m.,in response to message #3 by Darin Murphy 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

 Re: Odd date calc on 20bMessage #5 Posted by Katie Wasserman on 9 Aug 2008, 12:44 p.m.,in response to message #2 by cyrille de Brébisson 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.

Go back to the main exhibit hall