Skip to content

Instantly share code, notes, and snippets.

@cayblood
Created August 13, 2016 01:13
Show Gist options
  • Save cayblood/df37616a9dd1f11e6e7f9583769c1eed to your computer and use it in GitHub Desktop.
Save cayblood/df37616a9dd1f11e6e7f9583769c1eed to your computer and use it in GitHub Desktop.
iex(1)> alias Decimal, as: D
Decimal
iex(2)> D.set_context(%D.Context{D.get_context | precision: 2})
:ok
iex(3)> D.new("15.620000")
#Decimal<15.620000>
iex(4)> D.round(D.new("15.620000"), 2)
#Decimal<16>
@cayblood
Copy link
Author

I would like this to return #Decimal<15.62>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment