Re: [Hampshire] Python multiplicaton

Top Page

Reply to this message
Author: Keith Edmunds
Date:  
To: hampshire
Subject: Re: [Hampshire] Python multiplicaton
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

--
Keith Edmunds

+-------------------------------------------------------------------------+
|    Tiger Computing Ltd    |  Helping businesses make the most of Linux  |
|  "The Linux Specialists"  |       http://www.tiger-computing.co.uk      |

+-------------------------------------------------------------------------+