A tiny New Year's programming challenge
|
01-07-2015, 01:46 PM
(This post was last modified: 01-07-2015 02:00 PM by Dieter.)
Post: #21
|
|||
|
|||
RE: A tiny New Year's programming challenge
(01-07-2015 08:19 AM)Werner Wrote: Dieter: what's wrong with this? My first ever WP34S try! And no fiddling with flags. There's nothing wrong with it – it works just as well. Your routine checks if the year starts or ends on a Thursday. Which is equivalent to testing if 2 Feb is a Monday OR 2 Feb of the next year is a Tuesday. Your program evaluates this as (weekday(2.2.yyyy) – 1) * (weekday(2.2.yyyy+1) – 2) After omitting the initial CF.01 in my routine, both of our versions require 19 steps. Using NOT instead of SIGN +/– is a good idea – it will save another step. ;-) I should add that I also wanted to use as few calls to date routines as possible in order to speed up the program for calculators that do not offer such functions, so that a single call of WDAY would be preferred. But for such calculators maybe a completely different approach would make more sense. Thank you for your suggestion! Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)