Eqv: <=>

Imp: ->

Top  Previous  Next

One may wish to do conditional processing dependent upon whether one numerical expression has a particular logical equivalence relationship to another or not.  The form of the syntax that can be employed in such a case is

 

item1 opr item2

 

where opr is

 Eqv        for logical equivalence

or

 <=>        for logical equivalence

and

 Imp        for logical implication

or

 ->        for logical implication

These operate with results as follows

                 Result of imp condition        Result of eqv condition

         item1  -> item2                item1 <=> item2

item1 item1        item1 imp item2                item1 eqv item2

  0     0            1                    1

  0     1            1                    0

  1     0            0                    0

  1     1            1                    1

Example:

(impeqv.gms)

LOOP(CASE,

  result(case,"isimp")=0;

  result(case,"isimp")=0;

  result(case,item)=data(case,item);

  IF(DATA(case,"a") imp data(case,"b")

         ,result(case,"isimp")=1;);

  IF(DATA(case,"a") eqv data(case,"b"),

          result(case,"iseqv")=1;);

);