Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1943

Re: N[] MachinePrecision vs. Arbitrary Precision

From Sseziwa Mukasa <mukasa@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: N[] MachinePrecision vs. Arbitrary Precision
Date 2011-04-28 10:33 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ipbfpj$aat$1@smc.vnet.net> (permalink)

Show all headers | View raw


On Apr 27, 2011, at 5:39 AM, Rafael Dunn wrote:

> Mathematica 8.0.1.0, Mac OSX x86
>
> In:=
> N[Sin[Exp[100]]]
> N[Sin[Exp[100]], 1]
> N[Sin[Exp[100]], 11]
>
> Out:=
> -0.999105
> 0.1
> 0.14219812366
>
> I realize that N[exp] = N[exp, MachinePrecision].  This indicates when
> N[] is asked to calculate to MachinePrecision, it produces an incorrect
> result in this example.  However, when I use N[exp,n] where n <
> MachinePrecision, I get a correct output.  Is this because N[exp,n] uses
> ExtraPrecision, while N[exp] does not? 

Not really, the behavior of N[e] and N[e,p] is different even if p == MachinePrecision, the relevant text in the help guide is:

>  N[e] typically works by replacing numbers with machine numbers and computing the result:


and

>  N[e,p] works adaptively using arbitrary-precision numbers when  p is not MachinePrecision:

So N[Sin[Exp[100]]] is equivalent to N[Sin[Exp[100.]]] but N[Sin[Exp[100]], p] evaluates Exp[100] arbitrary precision.  Consider:

In[41]:= N[Exp[100.]]
N[Exp[100]]
N[Exp[100], MachinePrecision]
N[Exp[100], $MachinePrecision]
Out[41]= 2.68812*10^43
Out[42]= 2.68812*10^43
Out[43]= 2.68812*10^43
Out[44]= 2.688117141816135*10^43
In[37]:= $MachinePrecision == MachinePrecision
Out[37]= True

Regards,
	Sseziwa

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: N[] MachinePrecision vs. Arbitrary Precision Sseziwa Mukasa <mukasa@gmail.com> - 2011-04-28 10:33 +0000

csiph-web