Re: prePEP: Decimal data type

From: Mel Wilson (mwilson_at_the-wire.com)
Date: 11/08/03


Date: Sat, 08 Nov 2003 10:49:10 -0500

In article <mailman.486.1068133439.702.python-list@python.org>,
"Tim Peters" <tim.one@comcast.net> wrote:
> The conversion of prices into euros will require the use of a six-
> significant-digit conversion rate (six digits disregarding initial
>zeros)
> which should not be rounded or truncated. This rate will be irrevocably
> fixed on 1 January 1999 and defined in the form of one euro expressed in
> national currencies.
>
>So that part mandates a *floating* point input (not meaning binary floating
>point, but "6 digits disregarding initial zeros" is the essence of floating
>point -- the total number of digits isn't fixed, nor is the # of digits
>after the decimal point fixed, just the # of *significant* digits).
>
> To convert from national currencies to the euro, one has to divide by
> the conversion rate. To convert from the euro to the national currency,
> one has to multiply by the conversion rate. The use of inverse rates is
> forbidden.
>
>Neutral.
>
> To convert from one national currency to another, amounts must be first
> converted into euros and then into the second national currency. The
> euro amount must be rounded to three decimal places. The national
> currency should then be rounded to two decimals.
>
>So no single fixed-point discipline can suffice: in one direction they want
>rounding to 3 digits after the decimal point, in the other to 2 digits, and
>one of the inputs is a floating-point value with no fixed number of digits
>after the decimal point.

   The toy Decimal I'm playing with has a class variable
specifying number of digits to the right of the decimal
point, and this gets used on calls to rounding method(s).
By deriving Euros and Dollars from the Decimal class with
the right digit specifications and calling for rounding at
the right time I might be able to do that.

        Regards. Mel.



Relevant Pages

  • Re: EURO CONVERTER
    ... If you can tell us that, I would think the insertion of that Name ... through Insert>Name>Define with value equal the conversion rate between ... Pesetas and Euros will solve you problem. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: re currency
    ... conversion rate in sweden ... for Euros? ... Use the link on my website. ... One sweedish Kronor equals 421.161 Zambian Kwachas. ...
    (alt.marketing.online.ebay)
  • Re: Currency Conversion
    ... Put the conversion rate in a cell, copy it, select the cells you want to ... For instance if you have 1000 euros in A1 ... Pounds Sterling. ...
    (microsoft.public.excel.misc)
  • Re: re currency
    ... are the cross border currency ... conversion rate in sweden ... for Euros? ... You played on "The Love Boat"? ...
    (alt.marketing.online.ebay)
  • Re: FAQ Topic - Why does simple decimal arithmetic give strange results? (2009-08-11)
    ... Instead of calculating money in euros to two decimals, ... in cents and insert a decimal point only for output. ... John Stockton, nr London UK. ...
    (comp.lang.javascript)