Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Serious Bug in Mathematica 7 and 8.0.4.0 (latest version)
Replies: 2   Last Post: Apr 24, 2012 5:33 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Bailey

Posts: 712
Registered: 11/7/08
Re: Serious Bug in Mathematica 7 and 8.0.4.0 (latest version)
Posted: Apr 24, 2012 5:31 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 23/04/2012 10:43, Alexander Mayer wrote:
> In[1]:= (* This notebook produced by Mathematica 8.0.4.0 *)
> (* Platform: OSX 10.6.8 on MacBook Pro *)
>
> In[1]:= b = 6371.01 (* We set the value of b to this real number. *)
>
> Out[1]= 6371.01
>
> In[2]:= SetPrecision[a = b, 20] (* We test the actual value of b. *)
>
> Out[2]= 6371.0100000000002183
>
> In[3]:= (* Mathematica has added a small constant! *)
>
> In[4]:= (* Adding zeros to the 16th place fixes the problem. *)
>
> In[5]:= c = 6371.0100000000000000
>
> Out[5]= 6371.0100000000000000
>
> In[6]:= SetPrecision[a = c, 20]
>
> Out[6]= 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!

David Bailey
http://www.dbaileyconsultancy.co.uk







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.