Not only can arithmetic and logical operations be arbitrarily complex, they can also be combined together in very flexible ways. Of course we have already seen examples of this because "(c2-c3)>7" combines an arithmetic expression, "c2-c3", with a logical one, "result>7".
If this is the first time you are reading this manual then you may want to skip this section and come back to it later. Still here? Okay, here we go. The first point is that arithmetic values also have a logical value, which means that any number not equal to zero is logically true and any number equal to zero is false. So:
The second, more useful, point is that any logical expression has an arithmetic value, which is 1 if it is true and 0 if it is false. So:
Which means we can write:
c3*(c2<c3) + c2*(c2>=c3)to mean "whichever is higher of c2 and c3". If c3 is higher then the value inside the first brackets will be true, so 1. Then we multiply c3 by 1 and get c3. But the value in the second brackets will be false, or 0, and c2 multiplied by 0 is 0 and the whole expression will evaluate to c3*1+0, or c3. If c2 is higher than c3 or equal to it then c2 will be given as the result.
Here's another one:
LN( C15*(C15>0) + 0.0001*(C15<=0) )The idea of this is to take the natural log of c15. But if c15 were less than or equal to zero then trying to take its log would cause an error, so what this expression in fact does is to take the natural log of c15 if it greater than zero, but otherwise it takes the natural log of 0.0001.
We hope this gives you an idea of the principles involved. You can do almost anything with the operators provided, though some things are a bit long-winded. More examples will be given in individual command descriptions, and especially in the descriptions of the ARITHMETIC and INPUT commands. Incidentally, perhaps you can see now why we could not just write:
5<c5<10to specify that c5 should lie between 5 and 10. EASISTAT would interpret the expression as follows: 5<c5 is either true or false; if it is true it has a value of 1 and if it is false it has a value of 0; whether it has a value of 0 or 1 it will still be less than 10, so the expression as a whole will always be true.