Shwinn Ricci wrote:
When comparing a given value with a database of values, but allowing for
freedom due to variation at say, the thousandth digit, how does one
generalize the precision to this degree? I don't want to truncate, so is
there a round() function that takes into account what decimal place the
value (database value) needs to be rounded to?

Thousandth digit??? Python doesn't support floating point numbers with a thousand digits! I think about seventeen is about the limit.


Yes, there is a round function:


>>> x = 123.45678
>>> y = 123.45731
>>> x == y
False
>>> round(x, 3) == round(y, 3)
True




--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to