## Odds conversion functions

Odds conversion is something you will hardly ever need. For most it would be sufficient to use a conversion tables.

But if you actually need to convert odds as part of a script here is how to do so:

There are three types of odds format:

• Fractional: 9/5 for every 5 dollars you invest you get 9 if you win and the original 5 stake.
• Decimal: 2.8 for every dollar you invest you get 2.8 dollars, that include the original stake.
• American: American odds are divided to two parts positives and negatives.
Positive: 180 for every \$100 you invest you win \$180 and get your \$100 stake back.
Negative: -180 to win \$100 you need to invest \$180, so if you invest \$180 and win you get \$100 and the \$180 stake back.

Conversion between odds is rather simple.

Given the fractional odds `numerator/denominator` ( for short: `num/den`)
The decimal odds are computed as ```decOdds = ((num+den)/den) ```The American odds are computed as follow
```if (num/den > 1 )     usOdds = ((num/den)*100) else     usOdds = ((den/num)*(-100))```