Skip to content

Commit

Permalink
Fixed binary operation result for <, <=, >, and >= operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Jun 30, 2024
1 parent 0e04f6d commit 4e7e2b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/xyz/uartix/ast/expr/BinaryExpression.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,25 @@ else if(Objects.equals(operator, "^")) {
}
else if(Objects.equals(operator, "<")) {
if(leftValue instanceof Double && rightValue instanceof Double)
return UartOperation.lt((double) leftValue, (double) rightValue);
return UartOperation.lt((double) leftValue, (double) rightValue) == 1.0;

throw invalidVisit;
}
else if(Objects.equals(operator, "<=")) {
if(leftValue instanceof Double && rightValue instanceof Double)
return UartOperation.le((double) leftValue, (double) rightValue);
return UartOperation.le((double) leftValue, (double) rightValue) == 1.0;

throw invalidVisit;
}
else if(Objects.equals(operator, ">")) {
if(leftValue instanceof Double && rightValue instanceof Double)
return UartOperation.gt((double) leftValue, (double) rightValue);
return UartOperation.gt((double) leftValue, (double) rightValue) == 1.0;

throw invalidVisit;
}
else if(Objects.equals(operator, ">=")) {
if(leftValue instanceof Double && rightValue instanceof Double)
return UartOperation.ge((double) leftValue, (double) rightValue);
return UartOperation.ge((double) leftValue, (double) rightValue) == 1.0;

throw invalidVisit;
}
Expand Down

0 comments on commit 4e7e2b0

Please sign in to comment.