Logo

Programming-Idioms

History of Idiom 65 > diff from v4 to v5

Edit summary for version 5 by :

Version 4

2015-05-06, 21:04:51

Version 5

2015-07-31, 20:20:50

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%"

Code
$s = sprintf "%.1f", $x*100;