MathGroup Archive 2005

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

Search the Archive

Re: precision of numbers

On Wed, 9 Feb 2005 09:27:29 -0500 (EST)
 fartous at wrote:
> in the product:
> 15525600000*445.25*24
> the output is:
> 1.65907*(10^14)
> also when we use:
> N[15525600000*445.25*24, 15]
> the output is 1.65907*(10^14)
> but i want the precise number:
> 165906561600000
> what could i do
> jack


When you use a point anywhere in your expression, Mathematica treats the
numbers in the output automatically as machine or arbitrary precision numbers,
so if you want exaxt results don´t use it:

In[..]:=  15525600000*(445 + 1/4)*24
Out[..]:= 165906561600000

well, you can specifiy the accuracy by adding the NumberMark `precision:

In[..]:= 15525600000*445.25`20*24
Out[..]:= 1.6590656160000000000×10^14

(without specifying, the default is $MachinePrecision (16, or somehting like

Well, if you want to controll the number of digits, Mathematica should print
out, use NumberForm.

In[..]:= NumberForm[15525600000*445.25`20*24, 13]

The answer to your question is AccountingForm which forces Mathematica not to
use scientific notation:

In[..]:=15525600000*445.25*24// AccountingForm

(But as you can see, the dot at the end indicates, that the number is floating
- point not exact)

With the Function N[exp,n] Mathematica tries to find an n-digit approximation
to the expression exp. This is a diffrerent approach, as you can see with this

In[..]:= N[15525600000*(445 + 1/4)*24, 20] // AccountingForm
Out[..]:= 165906561600000.00000

Look the Help Browser for more details (see also ScientificForm,
EngineringForm, Precision,Accuracy,...)

A question to other users: Which option in the Options Inspector defines the
number of digits, Mathematica should print out by default, when formatting
machine precision numbers. I want to tell Mathematica to print out all known
digits by default, without specifying it with number marks


Christoph Lhotka

  • Prev by Date: Re: finding package in ExtraPackages`Enhancements`
  • Next by Date: Re: problem with FindRoot
  • Previous by thread: Re: precision of numbers
  • Next by thread: Plotting just specific points