The Euro is coming!

By: Matthias Thoma

Abstract: This article describes how to convert EMU currencies to Euros.

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

1.95583 DEM (Germany)
166.386 ESP (Spain)
40.3399 BEF (Belgium)
40.3399 LUF (Luxemburg)
5.94573 FIM (Finland)
6.55957 FRF (France)
13.7603 ATS (Austria)
200.482 PTE (Portugal)
0.787564 IEP (Ireland)
2.20371 NLG (Netherland)
1936.27 ITL (Italy)

 

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
http://www.europa.eu.int/euro/html/dossiers/00121/00121-en.pdf
 


Server Response from: ETNASC01