Re: inconsistency with Inequality testing and Floor
- To: mathgroup at smc.vnet.net
- Subject: [mg59962] Re: inconsistency with Inequality testing and Floor
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 26 Aug 2005 04:54:04 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 8/25/05 at 6:34 AM, muckle.moose at gmail.com (Brett Patterson) wrote: >I have observed the following strange behaviour: >---------------------- >In[1]:= x = 1.0 - 10^-($MachinePrecision) >Out[1]= 1. >In[2]:= x >= 1 >Out[2]= True >In[3]:= Floor[x] >Out[3]= 0 >---------------------- >It seems that the inequality test and Floor use different numerical >methods. I think this behaviour is inconsistent. If the test "x >= >1" evaluates to True, then Floor[x] should evaluate to 1. >Can anyone shed any light on this? The situation is exactly as you surmize. From the Help Browser entry on Equal Approximate numbers are considered equal if they differ in at most their last eight binary digits (roughly their last two decimal digits). You created a machine precision number that is less than 1 and differs from 1 by less than 8 binary digits. So, Floor returns 0 and it tests equal to 1 per the documentation. -- To reply via email subtract one hundred and four