Skip to content

Commit 3439092

Browse files
gh-131: Fix INV.
1 parent acb49ba commit 3439092

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/builtins.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6895,20 +6895,7 @@ static Value builtin_inv(Interpreter* interp, Value* args, int argc, Expr** arg_
68956895
return out;
68966896
}
68976897

6898-
// numeric inverse behavior preserved
6899-
EXPECT_NUM(args[0], "INV", interp, line, col);
6900-
if (args[0].type == VAL_INT) {
6901-
if (args[0].as.i == 0) {
6902-
RUNTIME_ERROR(interp, "Division by zero", line, col);
6903-
}
6904-
if (args[0].as.i == 1) return value_int(1);
6905-
if (args[0].as.i == -1) return value_int(-1);
6906-
return value_int(0);
6907-
}
6908-
if (args[0].as.f == 0.0) {
6909-
RUNTIME_ERROR(interp, "Division by zero", line, col);
6910-
}
6911-
return value_flt(1.0 / args[0].as.f);
6898+
RUNTIME_ERROR(interp, "INV expects MAP argument", line, col);
69126899
}
69136900

69146901
// KEYS(map):TNS - return 1-D tensor of keys in insertion order

0 commit comments

Comments
 (0)