This language bar is your friend. Select your favorite languages!
Edit summary for version 25 :
[Elixir] +DemoURL

Version 24

Version 25

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Extra Keywords
percent
Extra Keywords
percent
Code
s = "#{Float.round(x * 100, 1)}%"
Code
s = "#{Float.round(x * 100, 1)}%"
Doc URL
http://elixir-lang.org/docs/stable/elixir/Float.html#round/2
Doc URL
http://elixir-lang.org/docs/stable/elixir/Float.html#round/2
Demo URL
http://play.elixirbyexample.com/s/5baa0aa6d6