Re: floor problems
- To: mathgroup at smc.vnet.net
- Subject: [mg8141] Re: [mg8113] floor problems
- From: seanross at worldnet.att.net
- Date: Fri, 15 Aug 1997 23:41:52 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Tom wrote: > > Hello Mathematica users. > > I had a very frustrating time trying to debug some work I was doing in > Mathematica. I finally pared it down to a problem with the Floor > function, and I have illustrated my concern below. I am using M 3.0 and > a Mac computer. Does anyone have any advice or could you tell me if I > am doing something wrong? > > Floor[(.7 67 10)] > > 469 > > Floor[(67 10 .7)] > > 468 > > Sincerely, > > Tom De Vries > -- > Vermilion Home Education Program > > Tom De Vries > > 11003 - 132 st. > Edmonton, AB > Canada > T5M 1E4 > > Phone: (403)451-5822 > Fax: (403)454-0173 > > email: tom.devries at schoolofhope.org > email: toad at planet.eon.net A follow-on to my previous message. It is InputForm you need, not FullForm. Anyway, from the example below, you can see that there is indeed a small amount of round-off error in the second formulation. Since you are dealing with approximate real numbers, this error is well within expected tolerance, but does point out that you should not use Floor without error trapping if you expect approximate real numbers to be the rounded equivalent of an integer. In[13]:= InputForm[.7 10 67-469] Out[13]//InputForm= 0. In[12]:= InputForm[10 67 .7-469] Out[12]//InputForm= -5.684341886080801*^-14