Re: Decimal math bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg28786] Re: Decimal math bug?
- From: Jim Freeze <jim at freeze.org>
- Date: Sat, 12 May 2001 20:18:19 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Sat, 12 May 2001, Steven M. Christensen wrote:
This looks like a bug.
Can someone please explain.
This is Mathematica 4.1 (just purchased) on Linux.
In[88]:=(.53+.9) - (1.43) == 0
Out[88]:=False
---------^^^^^
In[89]:=(.53+.9) - (.43+1.0)== 0
Out[89]:=False
---------^^^^^
In[100]:=(.53+.9) - (.43+0.8+0.2) == 0
Out[100]:=False
----------^^^^^
In[102]:=(.53+.9) - (.43+0.8+0.1 +0.1) == 0
Out[102]:=True
----------^^^^
The above results from some strange decimal math:
In[67]:=Range[.53,4,.9]
Out[103]:={0.53, 1.4300000000000002, 2.33, 3.23}
where sometimes 1.4300000000000002 == 1.43 and sometimes
it doesn't.
It is really disconcerting to have that trailing 2.
Can someone please explain what is going on here?
Thanks
=========================================================
Jim Freeze
jim at freeze.org
---------------------------------------------------------
No comment at this time.
http://www.freeze.org
=========================================================