I'm trying to make a demonstration of how rounding to different numbers of digits affects things but I can't find a way to round numbers to a specified number of digits.
The Round
function only round to the nearest whole integer, and that is not what I always want. Other ways seems to only change the way the numbers are displayed, not how they are internally stored.
I want to throw away precision, but it seems Mathematica doesn't want to allow me to do this. As an example: I would like to round 3.4647 to just 3.5 or 3.46.
There must be some way to do this, but I can't for the life of me find it.
Round[x,a]
rounds to the nearest multiple ofa
$\endgroup$a
is a machine value, then after the rounding, the result has to be expressed in double precision binary, causing further rounding in the 52nd digit (base 2). Normally nobody would care, but if you're studying the effects of rounding and your investigation takes you into the realm of tiny changes and high precision, this effect could become important. $\endgroup$Round
does what is being asked for, and this is mentioned at the top of theRound
doc page. $\endgroup$