I should read more carefully. I glossed over Mono's answer, not realizing that STR already does this function I just wrote
print formatDecimal$(3.14159265359, 0)
print formatDecimal$(3.14159265359, 2)
print formatDecimal$(2.71828, 3)
print formatDecimal$(4, 7)
wait key
end
function formatDecimal$(x#, places)
x$ = str$(x#)
l = len(x$)
w$ = x$
for i = 1 to l
if mid$(x$, i) = "." then w$ = left$(x$, i-1) : exit
next i
if places = 0 then exitfunction w$
d$ = left$(right$(x$, l - len(w$)-1), places)
y = places - len(d$)
for j = 1 to y
d$ = d$ + "0"
next j
f$ = w$+"."+d$
endfunction f$