The Euro is coming!
Looking at some American home pages and software products I realized
that some of them are still not prepared for the European Monetary
Union. It is time to update your applications -- now!
One EURO is
Example 1: How much is 258 NLG?
258 / 2.20371 = 117.0752957513 EUR
=> 117.08 EUR (round to two decimals)
Example 2: How much NLG is 1000 EUR?
1000 * 2.20371 = 2203.71 NLG
=> 2203.71 NLG (round: two decimals)
Example 3: How much is 25000 ITL in FRF?
To convert one currency to another you MUST use the Euro in between.
25000 / 1936.27 = 12,91142247724 EUR
=> 12,911 EUR (three or more decimals!)
12.911 * 6.55957 = 84,69060827
=> 84,69 FRF
The complete rules for rounding and converting of currency amounts
can be found here
[1] (Publisher: European Commission)
Back to Delphi: EMUConv.pas
My EMUConv unit can be found at Code Central. ID: 15286.
It provides three functions:
function EMUCurrencyToEuro(Currency : string; Amount : Currency) : Currency;
function EuroToEMUCurrency(Currency : string; Amount : Currency) : Currency;
function EMUCurrencyToEMUCurrency(SourceCurrency, DestCurrency : string; Amount : Currency) : Currency;
The code should be usable for most scenarios. But please be aware that
it uses the extended format internally. To show you how it works,
here is the EuroToEMUCurrency function.
function EuroToEMUCurrency(Currency : string; Amount : Currency) : Currency;
var
i : Integer;
v : Extended;
begin
for i := 1 to NEMUCountries do
begin
if Currency = EMUCurrency[i].Currency then
begin
v := Amount / EMUCurrency[i].Euro;
Result := v;
exit;
end;
end;
raise EEuroError.Create('Currency unknown.');
end;
Do you want to know what a Euro looks
like? Click
here and here
[1] THE INTRODUCTION OF THE EURO AND THE ROUNDING OF CURRENCY AMOUNTS
https://www.europa.eu.int/euro/html/dossiers/00121/00121-en.pdf
Connect with Us