On 23/04/2012 10:43, Alexander Mayer wrote: > In:= (* This notebook produced by Mathematica 18.104.22.168 *) > (* Platform: OSX 10.6.8 on MacBook Pro *) > > In:= b = 6371.01 (* We set the value of b to this real number. *) > > Out= 6371.01 > > In:= SetPrecision[a = b, 20] (* We test the actual value of b. *) > > Out= 6371.0100000000002183 > > In:= (* Mathematica has added a small constant! *) > > In:= (* Adding zeros to the 16th place fixes the problem. *) > > In:= c = 6371.0100000000000000 > > Out= 6371.0100000000000000 > > In:= SetPrecision[a = c, 20] > > Out= 6371.0100000000000000 > Your original number is a machine precision number - that means it stored as a binary floating point number. Such a number will not in general be an exact decimal number - hence the small additional constant.
If you take a low precision number, there is no way for the system to conjure the extra precision information from nowhere!