Re: Numerical accuracy/precision - this is a bug or a feature?
- To: mathgroup at smc.vnet.net
- Subject: [mg119999] Re: Numerical accuracy/precision - this is a bug or a feature?
- From: "Kevin J. McCann" <kjm at KevinMcCann.com>
- Date: Mon, 4 Jul 2011 07:17:38 -0400 (EDT)
- References: <ius5op$2g7$1@smc.vnet.net>
BTW, you can skip the outer N[]: N[2,20]N[Sqrt[2],20] produces: 2.8284271247461900976 Kevin On 7/4/2011 6:47 AM, slawek wrote: > Let Mathematica (6.x, 7.x) compute quite a simple product > > In[1]:= N[N[2.0, 20] * N[Sqrt[2] , 20], 20] > > Out[1]= 2.82843 > > This is a bug. > > Why? > > Now we analyze it in details: > > 1. N[2.0,20] should give 2 with accuracy/precision/whatsever about 20 > decimal digits, i.e. 2.00000000000000000000 > > 2. Sqrt[2] should give... Sqrt[2] > > 3. N[Sqrt[2]] should give 1.4142135623730950488 (this is copy-paste from > Mathematica output to N[Sqrt[2]] ) > > 4. The product 2.00000000000000000000 * 1.4142135623730950488 is > 2.8284271247461900976 (again copy-paste) > > 5. BUT THE RESULT OF N[2.0, 20] * N[Sqrt[2] , 20] "truncated to 20 digits" > is Out[1]= 2.82843 > > Where are missing digits?! > > slawek > > > >