MathGroup Archive 2007

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

Search the Archive

Re: using N function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76379] Re: using N function
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 20 May 2007 02:44:03 -0400 (EDT)
  • References: <f2me6h$lu4$1@smc.vnet.net>

kkwweett schrieb:
> Good morning Mathematica users,
> 
> 
> Can anyone tell me, please, which of a),b) or c) is wrong :
> 
> a)
> <MathematicaHelp>
> <quote>
> 
> N[expr] is equivalent to N[expr, MachinePrecision].
> 
> </quote>
> </MathematicaHelp>
> 
> b)
> In[1]:=N[Exp[Sqrt[163 ]Pi] - 6403203]
> Out[1]=256.
> 
> 
> c)
> In[2]:=N[Exp[Sqrt[163 ]Pi] - 6403203,$MachinePrecision]
> Out[2]=743.9999999999993
> 
> ?
> 
> Thank you
> 
Hi,

don't mix MachinePrecision and $MachinePrecision!

b) and c) are wrong:

In[1]:= $Version
Out[1]= "5.2 for Linux x86 (64 bit) (June 20, 2005)"
In[2]:= N[Exp[Sqrt[163]*Pi] - 6403203]
Out[2]= 2.62537 * 10^17
In[3]:= N[Exp[Sqrt[163]*Pi] - 6403203, $MachinePrecision]
Out[3]= 2.625374126343655 * 10^17

which seems to be accurate, because:

In[4]:= NumberForm[N[Exp[Sqrt[163]*Pi] - 6403203, 10^4], {20, 15}]

gives (visually) the same output as in Out[3].

Regards,
Peter


  • Prev by Date: Re: All permutations of a sequence
  • Next by Date: Re: Guessing "exact" values
  • Previous by thread: Re: using N function
  • Next by thread: Re: using N function