COM - Currency

Mark Hammond mhammond at skippinet.com.au
Fri Dec 20 18:17:48 EST 2002


Matt Singer wrote:
> I understand:
> 
> "A currency number stored as an 8-byte, two's complement
> integer, scaled by 10,000 to give a fixed-point number with 15 digits
> to
> the left of the decimal point and 4 digits to the right.  This
> representation provides a range of 922337203685477.5807 to
> -922337203685477.5808"
> 
> And that for example if you read $3.50, you will get (0, 35000).
> 
> Now, when adding a record, what is the syntax for setting a field that
> is of type currency?

You can't :(  I am unlikely to fix this either - the FixedPoint module 
is being added to the core for Python 2.3, so I will almost certainly 
fix currency support in *both* directions using this module.  This will 
break people who rely on the tuple for currency, but I don't mind too 
much as it is completely useless and only works in one direction anyway.

Mark.




More information about the Python-list mailing list