Skip to content

Instantly share code, notes, and snippets.

@vdaubry
Created October 29, 2017 16:04
Show Gist options
  • Save vdaubry/e863fec5dc52df6094edf78d5e7f0cba to your computer and use it in GitHub Desktop.
Save vdaubry/e863fec5dc52df6094edf78d5e7f0cba to your computer and use it in GitHub Desktop.
money bug
capital = Money.from_amount("985.13464".to_f, "eu16")
price = Money.from_amount("707.5".to_f, "eu16")
size = Money.from_amount(capital / price, "btc16")
(capital - price * size.to_f).format
=> "€0,0000000000000000"
capital = Money.from_amount("985.13464".to_f, "eu16")
price = Money.from_amount("707.5".to_f, "eu16")
size = Money.from_amount(capital / price, "btc16")
(capital - price * size.to_d).format
=> "€-0,0000000000001500"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment