Skip to content

Commit

Permalink
Fix array division
Browse files Browse the repository at this point in the history
  • Loading branch information
phase committed Jul 26, 2015
1 parent 11e3afe commit de932d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/xyz/jadonfowler/o/O.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,20 @@ else if (b instanceof String) {
else if (c == '/') {
if (stacks[sid].peek() instanceof ArrayList<?>) {
double ans = 1;
boolean set = false;
for (Object o : (ArrayList<Object>) stacks[sid].pop()) {
if (o instanceof Integer) {
ans /= (int) o;
if (!set) {
ans = (int) o;
set = true;
}
else ans /= (int) o;
}
else if (o instanceof Double) {
if (!set) {
ans = (double) o;
set = true;
}
ans /= (double) o;
}
}
Expand Down

0 comments on commit de932d6

Please sign in to comment.