[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Rationalize
Just as another spot-check of portability, I tried out the slisp
definition of "rationalize" in the Symbolics CLCP, and it works.
However, on some hard cases (cases with large numerators and
denominators), it gets different answers than ours. For example, both
functions, given 1.6666666, return 5/3. However, if you lop off one 6
and try 1.666666, ours gets 798918/479351 whereas yours gets
873813/524288. In octal, that's 3030306/1650167 for ours and
3252525\2000000 for yours, which may be more revealing. Anyway, doing
the divisions back, using double precision, ours gives
1.666666030883789d0 (3.088d0 error), and yours gives 1.666659712820042d0
(2.872d0 error). I'm not sure what the significance [I know] of this is.
- Follow-Ups:
- Rationalize
- From: "Robert A. Cassels" <Cassels@SCRC-QUABBIN.ARPA>