Re: Time Calculations

From: Jerry W. Lewis (post_a_reply_at_no_e-mail.com)
Date: 04/18/04


Date: Sun, 18 Apr 2004 18:03:58 GMT

Re the math issue: Suppose
A1 = 7:00am = 7/24
A2 = 6:00am = 6/24
=(A1-A2-1/24)
returns 2.08E-17 instead of zero. This is not a math error.

Neither 7/24 nor 6/24 can be exactly represented in binary (much as
there is no exact decimal fraction representation for 1/3 You start with
0.3333, but you have to stop somewhere ...). The answer of 2.08E-17 is
the exact answer to a math problem that only approximates the math
problem that you intended. You run into these issues on any computer
that does binary floating point arithmetic (almost all software on
almost all hardware). As a result, requiring exact equality on
comparisons from non integer calculations is unrealistic.

Jerry

Matt wrote:

> Jerry
> Im not quite sure what you are saying but I guess I can use what I have. Wasnt sure if there was a way to do it through funtions or not.
> Thanks for the response
> Matt


Loading