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


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

Re: MachinePrecision vs. Arbitrary Precision

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: MachinePrecision vs. Arbitrary Precision
Date 2011-04-28 10:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ipbfs7$ad3$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 4/27/11 at 5:39 AM, worthless.trash.junk@gmail.com (Rafael Dunn)
wrote:

>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,

More specifically, this asks hardware to do the required computation.

>it produces an incorrect result in this example.

That is due to the limitations of floating point arithmetic as
implemented in hardware. The actual result you get will vary
according to what hardware is being used.

>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?

The key is whenever you use N[expr, n], you invoke Mathematica's
arbitrary precision arithmetic and Mathematica does what is
needed to get the desired precision. This often means the result
returned is more accurate than what you get from N[expr] even
when n is less than $MachinePrecision. And note, doing

N[expr, $MachinePrecision]

is quite different than doing either

N[expr]

or

N[expr, MachinePrecision]

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


Thread

Re: MachinePrecision vs. Arbitrary Precision Bill Rowe <readnews@sbcglobal.net> - 2011-04-28 10:34 +0000
  Re: MachinePrecision vs. Arbitrary Precision Scott Hemphill <hemphill@hemphills.net> - 2011-04-29 11:30 +0000

csiph-web