[Edu-sig] Re: rationals

Lloyd Hugh Allen lha2@columbia.edu
Fri, 11 Oct 2002 20:52:23 -0400


> But it would look like this:
> 
>   >>> a = 3/2r
>   >>> b = 1/2r
>   >>> a * b
>   (3/2r)

That won't do at all. (3/2)(1/2)==(3/4). I got terribly confused going
from here to the decimal representation. (And I suppose I'll never be
able to get implied division without a '*', while people are whining
about ninny things).

>   >>> float(a*b)
>   0.75

Here's a question from someone who hasn't used rationals outside of
Mathematica, TI-89/92, some sort of weird Casio, and the like, mostly in
an interactive basis, on an issue that people had later in the thread:
besides the representation given by the "print" command, how would code
be affected if the programmer expected a float and the engine had been
upgraded to return a rational instead? What would break?