Re: Numerical accuracy/precision - this is a bug or a feature?

*To*: mathgroup at smc.vnet.net*Subject*: [mg120162] Re: Numerical accuracy/precision - this is a bug or a feature?*From*: FranD <seacrofter001 at yahoo.com>*Date*: Sun, 10 Jul 2011 05:02:57 -0400 (EDT)

Is using "`" an acceptable work-around? a = 2.`30; b = Sqrt[2]; c = a b; check[x_] := {x, Precision[x]} check[a] {2.00000000000000000000000000000, 30.} check[b] {Sqrt[2], \[Infinity]} check[c] {2.82842712474619009760337744842, 30.} -FranD 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