[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My comments
Marcin 'Qrczak' Kowalczyk wrote:
> [The gcd, lcm, numerator, and denominator functions have] ill-defined
> results when the inputs are not known exactly: the slighthest
> inaccuracy in the input yields a totally different answer. R5RS gives
> them too broad domain.
Earlier I said that these functions are useless, but it just occurred to
me that they're necessary whenever you want to deal with a rational
number as a fraction (e.g., to carry out algebraic transformations or
for custom output). In those cases, it doesn't matter whether the
functions are accurate, so long as they're self-consistent.
For example, suppose that some calculation produces the inexact result
1/3 as an approximation to 219/658, and you want to write the fraction
into a TeX document. It doesn't matter that the numerator and
denominator are "wrong," because when you print them together as "1/3"
you still get the correct (if inexact) number.
Likewise, if you're performing algebraic transformations, it doesn't
matter if the GCD or LCM are wildly inaccurate on their own, because you
don't /use/ them on their own. Calculating GCD or LCM is just an
intermediate step. and the later steps in the process will get you back
to reasonable numbers.
These functions are not "ill-defined." Yes, you'll get a totally
different result than you would using exact numbers, but that doesn't
matter unless you use the results improperly (i.e., taking them out of
context instead of preserving their relationships).
Bradd W. Szonye