Re: [Hampshire] Python multiplicaton

Top Page

Reply to this message
Author: Owain Clarke
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Python multiplicaton






Keith Edmunds wrote:

On Sat, 16 Jan 2010 10:11:31 +0000, simbobo@??? said:



as the amounts are to do with pounds and pence, I
should convert everything pence before multiplying so that the
calculation is with integers.



Or use Binary Coded Decimal (BCD), which is designed for exactly this
purpose. See http://en.wikipedia.org/wiki/Binary-coded_decimal. PEP
regarding BCD at http://www.python.org/dev/peps/pep-3127/

hth,
Keith




Thanks.  You lot are always so helpful!