Re: A question about Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg34584] Re: [mg34559] A question about Mathematica
- From: BobHanlon at aol.com
- Date: Wed, 29 May 2002 02:44:32 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 5/27/02 3:54:14 AM, chenying at ccms.ntu.edu.tw writes: > I have a question about Mathematica and yet I couldn't find an answer >to. Could you please consider giving me a help on this? This is not a >long question and I hope it won't bother you too much. > > I was doing some computations. A computation gives me something like >A/A, another computation gives me something like B/B. I then do a >true-false statement, that is, If [A/A>=B/B, 1, 0]. Since both >computations (A/A and B/B) equal to one, the statement is true and hence >the If statement should lend a 1 as specified. > > However, I found out that the If statement lends a zero because >somehow, in the computations, A/A is less than B/B by the order of 10 to >the power of -16. > > Some friends told me that it must be because the bytes used by the >computations A/A and B/B are different, so to correct this problem, I >should assign the maximum byte to each object. > > Since I am not very familiar with Mathematica, after an afternoon's >search, I still have no clue about how to do that. > > Could anyone give me a help on this? I really appreciate it. > Instead of If[x >= y, 1, 0] use If[Chop[x-y] >= 0, 1, 0] Bob Hanlon Chantilly, VA USA