Programming Question

Aahz Maruch aahz at netcom.com
Tue Sep 21 10:00:03 EDT 1999


In article <37E7809E.A871480C at noreaster.cit.cornell.edu>,
Matthew Hirsch  <hirsch at noreaster.cit.cornell.edu> wrote:
>
>I'm still a little confused about precision and roundoff error.  Can
>someone please explain to me why this loop isn't working.  I'm trying to
>get a printout of all 81 numbers between -4.0 and 4.0 in 0.1
>increments.  The problem is that in the final iteration, a's value is
>becoming greater than 4.  It shows up as something like
>4.0000000000000000000xxxxx.  What can I do to get around this problem?
>I would greatly appreciate anybody's help.

You've already gotten good answers.  If you want more info, look up
"IEEE 754", which is the floating point standard.  (Not everything uses
IEEE-754, but it's a good starting point.)
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)




More information about the Python-list mailing list