Writing an equation to convert money.

Okay so this is a bit odd, I know, but I am currently attempting to write an equation for a way to convert Muggle money (USD, GBP, Euro) into Galleons, sickles and knuts (Harry Potter money) and vice versa. I have much of the stuff figured out, including the equation for Harry Potter money to real money. I am stumped on how to make a multi-stepped equation. Here is what I have so far. I will be working in GBP (UK Pounds) as it is the simplest.

The basics:

29 knuts to a sickle

17 sickles to a galleon

493 knuts to a galleon

1 galleon = 4.5368523 GBP

1 sickle = 0.26687366 GBP

1 Knut = 0.00920254 GBP

The equation for Harry Potter money to GBP is:

(knuts • 0.00920254) + (sickles • 0.26687366) + (galleons • 4.5368523) = £

The equation /so far/ for GBP to Harry potter money is:

(GBP / 4.5368523) - the whole numbers = Galleons

Divide the remaining decimals by (0.26687366) - the whole numbers = Sickles

Divide the remaining decimals by (0.00920254) = Knuts

I need to have this as one equation if this is possible. If anyone knows of a type of equation that could do this multi-stepped and muti-answer problem, please e-mail me or reply to this thread. If it is not possible to have as one equation, please let me know as well. Any tips or help would be greatly appreciated. This is not for university or any school assignment, but for a personal project, thus I hope I have the correct thread. I apologise if it is not. :)

My email is: Keelylovestofu@gmail.com

Re: Writing an equation to convert money.

Could you make your question more clear.

Do you want a code to run using softwares like Matlab or Scilab, is that what you are after?

Re: Writing an equation to convert money.

Quote:

Originally Posted by

**whycantigetausername** Could you make your question more clear.

Do you want a code to run using softwares like Matlab or Scilab, is that what you are after?

Actually I was wondering if someone could look at the equation for GBP to Wizarding money. The equation has text in it where I am confused on a math function. Is there a math function to take out integers? Basically, I need the equation to be a mathematics equation only, no text instructions. I really hope I am making this clear :(