[Tutor] re: range function

D-Man dsh8290@rit.edu
Thu, 24 May 2001 09:40:43 -0400


On Thu, May 24, 2001 at 12:33:54AM -0600, Bruce Sass wrote:
| On Wed, 23 May 2001, Bruce Sass wrote:
| 
| Here is a mistake I'm not going to make again.
...
| The only problem is I did it while in xemacs, using ^c^c, and the

^c^c? I thought it was C-c C-c ;-).  (I'm just teasing you, I don't
remember the emacs keys anymore)

| default python interpreter is 1.5.2 -- the #! was having no effect
| 'cause xemacs was passing the buffer onto /usr/bin/python.  When I
| pointed "python" to "python2.1" I got the ugly representation again.
| 
| Since...
| 
| >>> 5.5499999999999998 == 5.55
| 1
| 
| ...is it anything more than a cosmetic issue when print-ing, e.g., a
| list of floats (rather than the items in a list of floats).

Yes -- the actual number in memory hasn't changed.  If you look at my
example I used string interpolation to truncate the numbers at 2
decimal points when I printed my results.

If you want a description of the IEEE 754 floating point
representation I can give it to you (I had to implement addition,
subtraction and multiplication on single precision IEEE 754 floats in
m68k assembly for a lab, but I didn't have enough time to do the
multiplication)

-D