Why the following code
Table[ N[i, 4], {i, 1, 2, 0.5}]
do not output numbers with fixed number of digits, but gives this
{1., 1.5, 2.}
while there is no problems with this code
Table[ N[i, 4], {i, 1, 2}]
the output as expected is {1.000, 2.000}
0.5
is machine-precision. You could controll this by doingTable[ N[i, 4], {i, 1, 2, SetPrecision[ 0.5, 4 ] } ]
where you specify the precision to be used for0.5
. $\endgroup${i, 1, 2, 1/2}
$\endgroup$