Rev math
Victor Eijkhout
eijkhout at cs.utk.edu
Mon Mar 17 12:23:00 EST 2003
>>Yes. Use 14. (49 bits floating point) Use less if you need exact
>>equality.
>
>Thanks, Dar. So, does that mean we can take numbers of any length,
>go ahead and perform the operation, and then trust the result to 14
>digits,
Well, the usual roundoff error analysis of floating point arithmetic
still applies. You can always come up with computations that
completely lose your accuracy. For instance, suppose that
a=0.12345678901234 is the result of a computation and is accurate to
these 14 digits, and
b=0.12345678901233 is likewise accurate to 14 digits, then a-b is
0.10000000000000 times 10-to-the-minus-fourteen, but it's only
accurate to one digit.
> or do we first have to first preprocess the operands to a certain
>number of digits according to the type of operation?
No, you must avoid operations that are inherently inaccurate. For
instance, in the formula for the solutions of a quadratic equation
only one of the plus/minus possibilities is guaranteed to be
accurate. For a stable computation of the second you need to use a
different formula completely.
Numerical accuracy is not trivial. Most people don't see it until
they take a (graduate?) course in numerical mathematics or
computational computer science.
--
Victor Eijkhout <eijkhout at cs.utk.edu>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/
More information about the use-livecode
mailing list