Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119992] Numerical accuracy/precision - this is a bug or a feature?
  • From: "slawek" <slawek at host.pl>
  • Date: Mon, 4 Jul 2011 06:45:07 -0400 (EDT)

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

 



  • Prev by Date: Operations on RegularExpression matches
  • Next by Date: Re: A GUI Builder for Mathematica, or best existing solution..
  • Previous by thread: Re: Operations on RegularExpression matches
  • Next by thread: Re: Numerical accuracy/precision - this is a bug or a feature?