/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def f_to_dec(f, prec=2,sep='.') f.to_i.to_s+sep+((prec-(post=((f*(10**prec)).to_i%(10**prec)).to_s).size).times do post='0'+post end; post) end