MathGroup Archive 2011

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

Search the Archive

Re: MachinePrecision vs. Arbitrary Precision

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118468] Re: MachinePrecision vs. Arbitrary Precision
  • From: Scott Hemphill <hemphill at hemphills.net>
  • Date: Fri, 29 Apr 2011 07:30:55 -0400 (EDT)
  • References: <ipbfs7$ad3$1@smc.vnet.net>
  • Reply-to: hemphill at alumni.caltech.edu

Bill Rowe <readnews at sbcglobal.net> writes:

> On 4/27/11 at 5:39 AM, worthless.trash.junk at 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.

To emphasize that this is the result from hardware here is a program in
the C programming language:

  #include <stdio.h>
  #include <math.h>
  int main(void)
  {
    printf("%g\n", sin(exp(100)));
    return 0;
  }

And here is its output:

  -0.999105

Scott
-- 
Scott Hemphill	hemphill at alumni.caltech.edu
"This isn't flying.  This is falling, with style."  -- Buzz Lightyear


  • Prev by Date: Re: Expected value of the Geometric distribution
  • Next by Date: Re: Limit[f[x], x->a] vs. f[a]. When are they equal?
  • Previous by thread: Re: MachinePrecision vs. Arbitrary Precision
  • Next by thread: Postfix specification graphics, etc.