Decimal Literals
Ashley Yakeley
ashley@semantic.org
Sat, 12 Jul 2003 04:05:26 -0700
In article <egbrw1a0yk.fsf@sefirot.ii.uib.no>,
ketil@ii.uib.no (Ketil Z. Malde) wrote:
> I.e. for 3.14, allow any rational number in [3.14,3.15), or
> perhaps (3.135,3.145]?
Specifically the simplest rational in the range (I prefer the second
one, "round half even"). One rational is simpler than another if both
its numerator and denominator are closer to zero. In any given range,
there is one rational that is simpler than all the others.
I have a function that finds this rational, because I had to implement
it for HScheme, because there's a function specified in R5RS called
"rationalize" that must do this. In this case it tells me the simplest
rational is 22/7.
--
Ashley Yakeley, Seattle WA