RE: Comparison Error. Is ther

*To*: mathgroup at smc.vnet.net*Subject*: [mg12714] RE: [mg12678] Comparison Error. Is ther*From*: Ersek_Ted%PAX1A at mr.nawcad.navy.mil*Date*: Wed, 3 Jun 1998 02:21:04 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Chris wrote: | |I'm having trouble with comparisons, see below: | |In[10]:= x=0.9; | y=10; | |In[11]:= (1-x)y | |Out[11]=1. | |The above obviously evaluates to 1. | |In[12]:= (1-x)y <1 | |Out[12]= True | |The above gives the wrong answer. | |In[13]:= (1-x)y<1. | |Out[13]= False | |This gives the right answer, notice the decimal point after the 1. | | In the lines below I present a paradox somewhat related to the problem above. First I let (x) be a number near (-Pi/2) with eight digits of precision. In[1]:= x= -1.57079646`8; y=Tan[x] Out[2]= 0. x 10^6 (* Actually that's only the way it looks in a notebook. *) I think the result in Out[2] means the number is on the order of 10^6, but the leading digit is unknown. Now you get really strange results for the tests below. In[3]:= x1=6630000; {x1<r, r<x1} Out[3]= {False, False} In[4]:= x2=x1+1670000; {x2<r, r<x2} Out[4]= {False, False} In[5]:= { r==x1+100000, r==x1+200000, r==x1+300000, r==x1+400000} Out[5]= {True, True, True, True} What should we get for the results in Out[3], Out[4], Out[5] ? I think we should get "Uncertain" when two numeric values are compared, and we can't be certain that the result is True or False. ____________________ Ted Ersek