Program: 74704
Project: 74704
Buggy source:
/** 
 * Output the fixpoint value of the sum of the input bits.  If there is no inputs, then produce null.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  if (A.isKnown() && B.isKnown()) {
    BigInteger intResult=null;
    int bitsInResult=0;
    if (A.hasToken(0) && B.hasToken(0)) {
      FixPoint valueA=((FixToken)A.get(0)).fixValue();
      FixPoint valueB=((FixToken)B.get(0)).fixValue();
      int bitsInA=valueA.getPrecision().getNumberOfBits();
      int bitsInB=valueB.getPrecision().getNumberOfBits();
      bitsInResult=bitsInA < bitsInB ? bitsInA : bitsInB;
      BigInteger bigIntA=valueA.getUnscaledValue();
      BigInteger bigIntB=valueB.getUnscaledValue();
      if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.and(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.or(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.and(bigIntB).not();
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.or(bigIntB).not();
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.xor(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.xor(bigIntB).not();
      }
    }
    if (intResult != null) {
      Precision precision=new Precision(1,bitsInResult,0);
      FixToken result=new FixToken(intResult.doubleValue(),precision);
      sendOutput(output,0,result);
    }
  }
 else {
    output.resend(0);
  }
}

Fixed version (ground truth):
/** 
 * Output the fixpoint value of the sum of the input bits.  If there is no inputs, then produce null.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  if (A.isKnown() && B.isKnown()) {
    BigInteger intResult=null;
    int bitsInResult=0;
    if (A.hasToken(0) && B.hasToken(0)) {
      FixPoint valueA=((FixToken)A.get(0)).fixValue();
      FixPoint valueB=((FixToken)B.get(0)).fixValue();
      int bitsInA=valueA.getPrecision().getNumberOfBits();
      int bitsInB=valueB.getPrecision().getNumberOfBits();
      bitsInResult=bitsInA < bitsInB ? bitsInA : bitsInB;
      BigInteger bigIntA=valueA.getUnscaledValue();
      BigInteger bigIntB=valueB.getUnscaledValue();
      if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.and(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.or(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.and(bigIntB).not();
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.or(bigIntB).not();
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.xor(bigIntB);
      }
 else       if (operation.getExpression().equals("String_Node_Str")) {
        intResult=bigIntA.xor(bigIntB).not();
      }
    }
    if (intResult != null) {
      Precision precision=new Precision(((Parameter)getAttribute("String_Node_Str")).getExpression());
      Overflow overflow=Overflow.getName(((Parameter)getAttribute("String_Node_Str")).getExpression().toLowerCase());
      Rounding rounding=Rounding.getName(((Parameter)getAttribute("String_Node_Str")).getExpression().toLowerCase());
      FixPoint result=new FixPoint(intResult.doubleValue(),new FixPointQuantization(precision,overflow,rounding));
      sendOutput(output,0,new FixToken(result));
    }
  }
 else {
    output.resend(0);
  }
}