[Tutor] Is there anyway to set how many numbers are used afterthe decimal in floating numbers?

Alan G alan.gauld at freenet.co.uk
Thu Aug 18 23:29:34 CEST 2005


>I want to use it for a currency exchange program. It's useful, then 
>the user
> wouldn't have to round it himself/herself, and mistakes could be 
> avoided.

For currency you need to use the decimal module. Normal floating point
numbers are far too inaccurate for reliable currency conversion.

This is discussed in the Bank account example in the OOP topic
in my tutorial (the inevitable plug! :-)

Alan G.



More information about the Tutor mailing list