Don Guinn wrote: > John, isn't this whole thread revolving around what is a correct value? > To me it looks like a good part of this discussion revolve around many J > primitives converting to double precision floating point resulting in a > loss of precision. Are you defining a calculation as "correct" if the > result is the closest number representable in a double precision > floating point number to the result if calculated in infinite precision? > This may not be sufficient in some calculations. But that's as good as > it gets in most programming languages and is usually more than adequate. > The problem is that it is not always adequate. And that's as you say, > it's a numerical analysis question. >
Don: I am defining a calculation as "correct" if J performs floating point arithmetic without error, followiong the Dictionary definitions of primitives. I believe that for library functions such as exponentials and trigonometric functions, the results are also the nearest floating point number to the mathematical result. This notion of correctness is, as you say, as good as it gets. This is fine with me, but apparently not with Donna or Gerry. Let me spell out what I have been trying to say. Suppose f is a real valued function of one real variable which can be expressed in J using primitives as fj. Suppose x is a real number, y=f(x), and the nearest floating point numbers to x and y are xj and yj. Then in general: - fj(xj) is not equal to yj - the error in using fj(xj) to approximate yj is unknown - J does not keep track of this error However. the error is often small enough to be ignored in casual use. For many functions f there are methods of approximating yj to any desired floating point accuracy using only regular (not arbitrary precision) floating point arithmetic. These methods are typically different from just transcribing f as fj, and are considered in numerical analysis. Hope this makes it clear. Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
