Skip to content

Commit

Permalink
Adding support for other constants in Interval analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaneg committed Feb 21, 2024
1 parent f6d4253 commit 9e1a19b
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,25 @@ public Interval evalNonNullConstant(
Constant constant,
ProgramPoint pp,
SemanticOracle oracle) {
if (constant.getValue() instanceof Integer) {
if (constant.getValue() instanceof Byte) {
Byte i = (Byte) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
} else if (constant.getValue() instanceof Byte) {
Byte i = (Byte) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
} else if (constant.getValue() instanceof Integer) {
Integer i = (Integer) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
}
} else if (constant.getValue() instanceof Long) {
Long i = (Long) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
} else if (constant.getValue() instanceof Float) {
Float i = (Float) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
} else if (constant.getValue() instanceof Double) {
Double i = (Double) constant.getValue();
return new Interval(new MathNumber(i), new MathNumber(i));
}

return top();
}
Expand Down

0 comments on commit 9e1a19b

Please sign in to comment.