[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Once again a plea for slash

Indeed, I should apologize, and I do, for using the word "correct"
too loosely.  Let me instead simply say that there is currently
in MacLISP and sons *no* standard division operator that even
closely approximates  (// x y) = z  implies (* y z) = x,
because if x and y are integers z can differ from the mathematically
accurate result by as much as (x/y)-floor(x/y), which can be made
arbitrarily close to 1.  For small x and y the relative error can be
very large.  Worse yet, the expression (* y (// x y)) can have
arbitrarily large relative error because the error can be as much as y-1.
Floating-point numbers at least guarantee a reasonably small relative error
(for (* y (// x y)) no more than a couple of LSB's).

Instead of flaming about arcane numerical properties and algebraic
identities, perhaps I should just point out that this is another of
those glitches which can be a significant stumbling block for novices.
Sussman defines his own division operator for students to use for *two*
reasons: (1) so as not to have to double a slash; (2) to avoid behavior
like 1/3 => 0.