Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Re: MachinePrecision vs. Arbitrary Precision
Replies: 1   Last Post: Apr 29, 2011 6:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Scott Hemphill

Posts: 190
Registered: 12/13/04
Re: MachinePrecision vs. Arbitrary Precision
Posted: Apr 29, 2011 6:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Bill Rowe <readnews@sbcglobal.net> writes:

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


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@alumni.caltech.edu
"This isn't flying. This is falling, with style." -- Buzz Lightyear




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.