Re: Politically incorrect response to Re: a bug in RealDigits? Mathematica 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg45292] Re: Politically incorrect response to Re: a bug in RealDigits? Mathematica 5.0
- From: ancow65 at yahoo.com (AC)
- Date: Mon, 29 Dec 2003 00:22:02 -0500 (EST)
- References: <bs1btt$9pt$1@smc.vnet.net> <bsbna4$lt7$1@smc.vnet.net> <bsmacc$d9e$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Harold.Noffke at wpafb.af.mil (Harold Noffke) wrote in message news:<bsmacc$d9e$1 at smc.vnet.net>... > AC: > > Could you please elaborate on your comment ... > > > Because MachinePrecision depends on the underlying hardware > > architecture, Mathematica programs are hardware dependent! > > I had the notion that any problem could be set-up in Mathematica using > variables with arbitrary (user-specified) precision, but perhaps I > misunderstand the passage where I read this. > > Please help me clarify this. > > Harold Certainly. Go back to the original example. In[1]:= $MachinePrecision Out[1]= 15.9546 In[2]:= t1=39383738378094852309445543850343.49494; In[3]:= Precision[t1] Out[3]= 36.5953 In[4]:= RealDigits[t1] Out[4]= {{3,9,3,8,3,7,3,8,3,7,8,0,9,4,8,5,2,3,0,9,4,4,5,5,4,3,8,5,0,3,4,3,4,9,4,9},32} In[5]:= Unprotect[$MachinePrecision] Out[5]= {$MachinePrecision} In[6]:= $MachinePrecision=40 Out[6]= 40 In[7]:= t2=39383738378094852309445543850343.49494; In[8]:= Precision[t2] Out[8]= 36.5953 In[9]:= RealDigits[t2] Out[9]= {{3,9,3,8,3,7,3,8,3,7,8,0,9,4,8,5,2,3,0,9,4,4,5,5,4,3,8,5,0,3,4,3,4,9,4,9},32} The behavior of RealDigits did not change because Mathematica internally still uses the true machine precision of your processor no matter what you set. However, if you move from 32 to 64 bit processor machine, the result may change. I would love to see a proof invalidating this claim. It might go like this. Choose a number that is above the machine precision on 32 bit but within the one on 64 bit processor. Run the example above on both machines. Compare the results. I guess that one would get the correct result on 64 bit processor and wrong on 32 bit one. I suspect Mathematica's numerical model mixing machine and arbitrary precision to be the true source of problems and that there are other functions with similar issues. Remember, the hardware-dependent boundary between machine and arbitrary precision is the place, where weird things happen, and one can't just set that boundary by hand. ac