[Edu-sig] RE: Rationals
Douglas S. Blank
dblank@cs.brynmawr.edu
Fri, 11 Oct 2002 12:02:26 -0400
John Posner wrote:
>> int / int --> float
>>
>
>
> Why not this?
>
> int / int --> rat
>
> After all, the definition of "rational" is "int divided by int".
Many Scheme implementations do exactly that. In Scheme:
> (/ 12 23)
12/23
> (/ 3 33)
1/11
Maybe Python should make a distinction between what it prints, and the
internal form? For example, maybe internally Python would keep the most
precise form of an expression, but the display format (integer, float,
rational) could depend on other aspects (operator, hierarchy, or other
context-sensitive items).
-Doug
>
> --
> John Posner
> jjposner@snet.net
--
Douglas S. Blank, Assistant Professor
dblank@brynmawr.edu, (610)526-6501
Bryn Mawr College, Computer Science Program
101 North Merion Ave, Park Science Bld.
Bryn Mawr, PA 19010 dangermouse.brynmawr.edu