dly wrote:
> I am not sure where it is orbiting
>
> There is a concept called significance
>
> knowing the limitations of an algorithm such as it uses double
> precision floating point numbers means that is as precise as it gets
>
> there are other possibilities such as IEEE quadruple-precision
> floating-point data type "quadruple" (128 bits or 16 bytes).
>
> Do you think there is value in knowing whether something is
> calculated with single, double, quadruple precision?
>
> If it is all the same to you then don't worry if it is not all the
> same to me.
>
> Donna
> [EMAIL PROTECTED]
>
>

Donna:

32-bit J uses 64-bit floating point numbers with a 52-bit mantissa (since
it is normalized, this gives 53 bits of precision) and an exponent in the
range -1023 to 1024.

For approximating a single quantity, this translates to about 16 digits of
decimal precision.  An further calculations will have fewer digits of
precision, unpredictably in general.  Permuting the order of terms in
1+1e_16+_1 will give you 0, 1 and 16 digits of decimal precision, even
though each calculation is done using "double precision" arithmetic. 
Simply knowing that this is what the algorithm uses is of little value in
knowing the accuracy of the result.  That is why it is "all the same to
me": you need to do something else to ensure that calculations are
accurate.

People in scientific computing have thought about this issue a lot, and
there are ways of getting good results, although they may not be obvious.
Here is a simple example.  A common beginner's error is to estimate f'(x)
as (f(x+h)-f(x))/h with error O(h f''(x)), as in calculus, and think that
one can get a better result by making h as small as possible.  This
compounds subtracting two nearly equal quantities with dividing a large
number by a small number, almost guaranteeing a loss of significance. 
Using (f(x+h)-f(x-h))/(2h) will give a result with error O(h^2 f'''(x)),
typically allowing a larger value of h for the same accuracy with fewer
truncation problems.

The question "How do I ensure my calculations are accurate?" is too
general to answer.  There are many more specific questions that have good
answers.

Best wishes,

John

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to