MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Comparison Error. Is there an overall fix?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg12678] Comparison Error. Is there an overall fix?
  • From: "Chris Farr" <farr at brown.edu>
  • Date: Mon, 1 Jun 1998 23:16:50 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

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.

Do I have to remember to put 1. on the right hand side each time?  What
 if, on occasion, the left hand side turns out to be "1", instead of
"1." 
 Doing N[] is not a global fix, because sometimes my expression can be 
0.  In this case, N[0] is not "0.", it is just "0".  So, the N[] to
both  sides won't always work.

Is there some global way to correct for this kind of stuff????

Thanks in advance,

Chris



  • Prev by Date: Re: 3D graphs/coord. axes
  • Next by Date: Re: Missing link
  • Previous by thread: Re: 3D graphs/coord. axes
  • Next by thread: Re: Missing link