I want to pad with ending zero and tried the following code
d = 7;
f[x_] := 150/x
g[x_] := 2 Log[x] - 3
Table[{x, StringPadRight[ToString[NumberForm[N[f[x]], d]], d, "0"],
StringPadRight[ToString[NumberForm[N[g[x]], d]], d, "0"]}, {x, 20,
50}] // N // TableForm
which gave
20. 7.50000 2.99146
21. 7.14285 3.08904
22. 6.81818 3.18208
23. 6.52173 3.27098
24. 6.25000 3.35610
25. 6.00000 3.43775
which is kind of 'OK'.
Are there any better/shorter code to get this result?
Also, is there a simple way to remove the period for the integers in the first column?
numb[n_] := NumberForm[N[n, d], d]
then doTable[{x, numb@f[x], numb@g[x]}, {x, 20, 50}] // TableForm
$\endgroup$DecimalForm[Table[{x, N[f[x]], N[g[x]]}, {x, 20, 50}], {d, d - 2}]
. Among other things it will get the rounding correct. $\endgroup$