Logo

Programming-Idioms

History of Idiom 65 > diff from v22 to v23

Edit summary for version 23 by barroco:
New Elixir implementation by user [barroco]

Version 22

2016-05-28, 09:32:52

Version 23

2016-08-23, 09:23:11

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