Re: Numerical accuracy/precision - this is a bug or a feature?
- To: mathgroup at smc.vnet.net
- Subject: [mg120208] Re: Numerical accuracy/precision - this is a bug or a feature?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 13 Jul 2011 03:11:02 -0400 (EDT)
On 7/12/11 at 6:59 AM, slawek at host.pl (slawek) wrote: >U=C2=BFytkownik "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com> >napisa=C2=B3 w wiadomo=C2=B6ci grup dyskusyjnych:iv6h68$s97$1 at smc.vnet.net... >>considered too verbose), I do not think Mathematica's way of doing >>things is particularly arbitrary or confusing in the broader >>context of >If 1.4 is not the same as 14/10, then Mathematica should evaluate >1.4 == 14/10 as False. The documentation for Equal (==) specifically states: Approximate numbers with machine precision or higher are considered equal if they differ in at most their last seven binary digits (roughly their last two decimal digits). Since the exact value 14/10 differs from less than the last seven bits of the binary representation of 1.4 14/10 == 1.4 returns true. Note, by default whenever both machine precision values and exact values are in the same expression, Mathematica evaluates the expression as if everything was machine precision. And in general this is a good thing. The other choices would seem to be either leave 1.4 == 14/10 unevaluated or to return False. Both seem undesirable as they would likely cause far more problem than returning True as Mathematica presently does. Either of the other choices would certainly make expressions containing both exact and approximate values much more problematic to evaluate. Ultimately, since the developers are unlikely to change such a fundamental aspect of Mathematica, the only sensible thing is to understand how Mathematica does things if you want to effectively use Mathematica. The alternative would be to find a system that operates more to your liking.