On 12/06/14 09:18, Mark Lawrence wrote:
Besides Alan's previous statement about using integers you can also use
things like Python's decimal module see
https://docs.python.org/3/library/decimal.html#module-decimal

Although Decimal doesn't solve the issue of rounding errors for financial calculations (neither do pennies) nor the issues of
repeating results like 1/7.... It just moves them into the
more familiar territory of decimal numbers rather than binary.
So at least what you write is represented accurately.

As Steven said in his reply, floating point on computers is hard.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

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

Reply via email to