sc: fixed number of decimals

here's a quick function for displaying float numbers as strings in supercollider.

(
~fixDec= {|val, numDecimals= 2|  //float to string with fixed number of decimals
        var str= val.round(0.1**numDecimals).asString;
        var num= str.size-str.indexOf($.)-1;
        str.extend(str.size+numDecimals-num, $0);
};
)

//test examples
~fixDec.value(0.1, 3)
-> 0.100
~fixDec.value(0.12345, 3)
-> 0.123

//rounds internally.  compare:
~fixDec.value(0.191, 2)
-> 0.19
~fixDec.value(0.197, 2)
-> 0.20

//can deal with negative values
~fixDec.value(-2pi, 4)
-> -6.2832

//and integers
~fixDec.value(10000, 4)
-> 10000.0000

~fixDec.value(10000, 0)
-> 10000.