.q.fmt[x;y;z]

Where

returns z as a string of length x, formatted to y decimal places. (Since V2.4)

q).Q.fmt[6;2]each 1 234
"  1.00"
"234.00"

To format the decimal data in a column to 2 decimal places, change it to string.

q)fix:{.Q.fmt'[x+1+count each string floor y;x;y]}
q)fix[2]1.2 123 1.23445 -1234578.5522
"1.20"
"123.00"
"1.23"
"-1234578.55"

Also handy for columns:

q)align:{neg[max count each x]$x}
q)align fix[2]1.2 123 1.23445 -1234578.5522
"       1.20"
"     123.00"
"       1.23"
"-1234578.55"

Example: persist a table with float values to file as character strings of length 9, e.g. 34.3 to

"     34.3"

Keep as much precision as possible, i.e. persist 343434.3576 as "343434.36".

q)fmt:{.Q.fmt[x;(count 2_string y-i)&x-1+count string i:"i"$y]y}
q)fmt[9] each 34.4 343434.358
"     34.4"
"343434.36"