Feedback Use numerator, denominator, quotient, remainder, integer-floor, modulo 

Forum: Com Sci 12500, U Chicago, Autumn 2002, Discuss Classwork
Re: News Project Step #3, deadline Monday 18 November (Mike O'Donnell)
Re: Question Base conversion... (Benedict Singer)
Date: 2002, Nov 16
From: Mike O'Donnell <odonnell@cs.uchicago.edu>

I'm not aware of any special Scheme procedures for base conversion. It's pretty simple to do rational->xreal recursively with some of the procedures numerator, denominator, quotient, remainder, integer-floor, modulo. Notice that you may be forced into an infinite repeating trinary expansion even for a rational.

Because of the redundancy of base 3 notation with trits in the range -2 to 2, you have lots of choices. It doesn't matter which one you make. Two natural approaches are to produce only trits in the range -1 to 1, or only trits in the range 0 to 2. Each of these uses a different subset of the procedures mentioned above. Make sure that you are consistent. You are most likely to make errors with negative numbers.

where would the conversion be easiest to make - I'm not sure I see any especially easy place?
I don't understand the meaning of "place" in this question.

Don't think of this as a conversion of bases. A Scheme rational is not in any particular base. The conversion is from rational to the base-3 stream implementation of xreal, not from base 10 to base 3.




Mike O'D.


Messages

1. More Example? by Benedict Singer, 2002, Nov 16
1. More Never mind!! by Benedict Singer, 2002, Nov 16
2. Feedback Some examples of trinary expansions of rationals by Mike O'Donnell, 2002, Nov 16
2. Question floor by Mark Kittisopikul, 2002, Nov 18
1. Feedback floor of exact rationals is OK, of inexact numbers is not. by Mike O'Donnell, 2002, Nov 18

to: "Use numerator, denominator, quotient, remainder, integer-floor, modulo"