A Lot of HUF
August 02, 2015 ( Prev / Next )

I took a brief trip to Hungary to visit the final European Grand Prix. As in: the final Grand Prix in Europe that i hadn’t yet been to. Until next year at least, when the European Grand Prix makes a comeback1. At which point the final European Grand Prix i visit will be the actual European Grand Prix2.

Whilst Hungary is a member state of the European Union it is not a part of the Eurozone. Essentially they kept their own currency, the Hungarian Forint (HUF). If you read through the history of Hungary’s currency you have to wonder if their non-membership of the Eurozone is due to having faffed about with their currency many times over the years already3 and not wanting to do so again4.

Anyway it seems that most places in Hungary, or in this case Budapest, accept Euros so you can get away without withdrawing HUF. However i wanted to do so for two reasons. One being that the exchange rate isn’t exactly favourable if you do use Euros within the country, the second being that i wanted to get hold of a currency that had caused me all sorts of problems several years back. Pure curiosity.

In my last job i wrote some software that communicated with acquiring banks. As part of a “keep it simple” approach it had no restrictions on the currencies you could provide - as long as the provided data was in the list of ISO 4217 currency codes you could transact in it5. So when i was asked if we could support HUF i nodded, double checked the details in the standard, and said it was good to go.

A few weeks later we received a bug report from some rather irate Hungarian cardholders, stating that they had been charged one hundred times the value of their purchases. This seemed odd because, again, as part of a “keep it simple” approach there was no exponent handling in the software - you had to pass it the value of the transaction in minor units, which would then be forwarded on to the acquiring banks (as per other ISO standards). So €1 would be sent as 100 with the currency code EUR6, because it has a minor exponent of 2. It means you don’t have to deal with integer division in the code, a wonderful source of bugs is eliminated.

The same principle follows for HUF because, as per the ISO spec it has a minor exponent of 2… Or does it? Well yes it does, officially, but unofficially it doesn’t because it’s not used in real transactions anymore. The minor units in question, the fillér, have not been in circulation since 19997. In fact, inflation pushed the value of the Forint so high (or is that low?) that the lowest denomination coin is now 5 Ft. Curiously petrol stations will still use the defunct minor units in displays8:

But they don’t use it in the transaction, because 23.66 (Ft/l) * 423.9 (Ft) = 10029.474 Ft. Yet i was charged 10030 Ft because, as previously mentioned, the lowest denomination coin is 5 Ft. Rounding up applies here. Had they just said 424 Ft/l the total would have been 10031.84 and rounding down to 10030 would have applied. The exact same outcome!

When we sent transactional data to the banks for HUF we followed the ISO 4217 spec and used a minor exponent of 2. The above fill up would have been sent as 1002947 with a currency code of HUF (or 348). Unfortunately the banks decided that the unofficial logic applied here, and ignored the ISO spec, treating the currency as having no minor units. 1002947 Ft rather than 10029.47 Ft. That would be one expensive fill up.

The fix was trivial, to mark HUF as having no minor units and to include a comment in the code + commit message + bug tracking system as to why we were not adhering to the ISO spec. The lesson is clear though: just because you’re following the specs to the letter don’t assume anyone else is, especially when dealing with monetary transactions.

The picture at the top shows the last of the HUF i have left from my trip, 1030 Ft, or about €3.fiddy


  1. It’s been away since 2013 

  2. And just to confuse matters more, the European Grand Prix will be held in Azerbaijan, so it could in fact be called the European/Asian Grand Prix. 

  3. Some history

  4. Admittedly it’s more complex than that. 

  5. Even Gold, Platinum and Silver. Seems that Bitcoin is yet to be accepted by the standard. 

  6. Or 978, depending on which spec or which part of the process you were dealing with. 

  7. See that history bit again. 

  8. Amongst others, probably a psychological thing? I can’t recall if every station used the .9 trick or if there were other values that would result in ±20 Ft on the final total. 

f1, travel, software