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


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

Re: N[] MachinePrecision vs. Arbitrary Precision

Started bySseziwa Mukasa <mukasa@gmail.com>
First post2011-04-28 10:33 +0000
Last post2011-04-28 10:33 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

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

#1943 — Re: N[] MachinePrecision vs. Arbitrary Precision

FromSseziwa Mukasa <mukasa@gmail.com>
Date2011-04-28 10:33 +0000
SubjectRe: N[] MachinePrecision vs. Arbitrary Precision
Message-ID<ipbfpj$aat$1@smc.vnet.net>
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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web