MathGroup Archive 2009

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

Search the Archive

Re: Odd behavior?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101874] Re: [mg101850] Odd behavior?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Mon, 20 Jul 2009 06:02:22 -0400 (EDT)
  • References: <200907191115.HAA20885@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

The version 7 answer is correct.

The answer zero assumes infinite precision for the inputs, when in fact  
they're only "machine" precision.

That said, you could use the code

5.1 - 4.5 - 0.6 // Chop

0

This gives infinite precision to a calculation that doesn't deserve it,  
but then again, it probably does no harm.

Bobby

On Sun, 19 Jul 2009 06:15:43 -0500, elliot <esadlon at stevens.edu> wrote:

> The expression 5.1 - 4.5 - 0.6 gives different answers depending on the  
> version of Mathematica. Version 6 says 0. (which is obviously what we  
> expect) with an accuracy of about 307. Version 7 says -3.33067x10^-16  
> with an accuracy of about 31. Also, in version 7, if the expression is  
> changed to 5.1 - (4.5 + 0.6) the answer it gives is 0. with an accuracy  
> of about 307. Both versions were run on three different computers.
>
> Anybody know what changed or what I can do to prevent such poor  
> solutions (besides forcing a specific order of evaluation)? Thanks.
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: Invisible - misleading documentation
  • Next by Date: Re: Invisible - misleading documentation
  • Previous by thread: Odd behavior?
  • Next by thread: Re: Odd behavior?