This language bar is your friend. Select your favorite languages!
Edit summary for version 23 :
New Elixir implementation by user [barroco]

Version 22

Version 23

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)}%"
Doc URL
http://elixir-lang.org/docs/stable/elixir/Float.html#round/2