[futurebasic] Re: [FB] Days between dates

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2003 : Group Archive : Group : All Groups

From: Chip Griffin <n1mie@...>
Date: Sun, 11 May 2003 14:46:20 -0400
On Sunday, May 11, 2003, at 09:42 US/Eastern, tedd wrote:

> Assuming that just counting days between dates will provide the right 
> answer is a shaky assumption -- to which I was replying.
>
> Granted, when the right answer is assured, then speed can become an 
> issue for things that require significant time to process. However, 
> with such a simple problem as determining days between dates; and the 
> computing power of current machines; I doubt if speed would be an 
> issue using any efficient algorithm. Even with my old Apple ][, I 
> doubt if determining days between dates would have presented any 
> noticeable time problems.

I guess that depends on how far apart the dates are. I seem to recall 
that counting to 10,000 was non-trivial time-wise and was oft used for 
an intentional time delay in BASIC programming.

My reply was initially to the comment that counting ought to be easier 
and therefore better. My point was that I felt that assuming you could 
get the right answer with either method, that the formula would be 
better for speed reasons. I stick by that assertion. There may be cases 
where it's fine to count. But as a general rule, I would assert that 
using a slower method when a faster one exists may be a sign of sloppy 
programming. Certainly some of our scholarly programming wizards can 
give us examples where my assertion would be false, but I think more 
often than not (by a significant percentage) it is true.

Perhaps we should do a test to see what the speed difference is between 
counting and a formula for two dates significantly apart. Try something 
even as close as 2192 days (~6 years) and go from there.

-- Chip