Skip to content

Commit

Permalink
fix minus on int|real
Browse files Browse the repository at this point in the history
  • Loading branch information
5pilow committed Oct 1, 2023
1 parent bb87e58 commit 879cb17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/leekscript/runner/AI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,11 @@ public Object minus(Object value) throws LeekRunException {
return -longint(value);
}

public Number minus(Number value) throws LeekRunException {
if (value instanceof Double) return -((Double) value);
return -longint(value);
}

public long bnot(Object value) throws LeekRunException {
return LeekValueManager.bnot(this, value);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/test/TestInterval.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void run() throws Exception {
code("return intervalMin([1..0])").equals("1");
code("return intervalMin(]..[)").equals("-∞");
code("intervalMin([1..2])").ops(3);
code_v3_("Interval inter = [1..10] integer min = -intervalMin(inter) return min").equals("-1");

section("Interval.intervalMax");
code("return intervalMax([1..2])").equals("2");
Expand Down

0 comments on commit 879cb17

Please sign in to comment.