mirror of
https://github.com/janet-lang/janet
synced 2025-10-24 04:07:41 +00:00
First commit removing the integer number type. This should
remove some complexity and unexpected behavior around numbers in general as all numbers are the same number type, IEEE 754 double precision numbers. Also update examples and tests, some of which were out of date. Some more testing may be needed for new changes to numbers.
This commit is contained in:
@@ -242,18 +242,14 @@ static int cfun_slice(JanetArgs args) {
|
||||
/* Get start */
|
||||
if (args.n < 2) {
|
||||
start = 0;
|
||||
} else if (janet_checktype(args.v[1], JANET_INTEGER)) {
|
||||
start = janet_unwrap_integer(args.v[1]);
|
||||
} else {
|
||||
JANET_THROW(args, "expected integer");
|
||||
JANET_ARG_INTEGER(start, args, 1);
|
||||
}
|
||||
/* Get end */
|
||||
if (args.n < 3) {
|
||||
end = -1;
|
||||
} else if (janet_checktype(args.v[2], JANET_INTEGER)) {
|
||||
end = janet_unwrap_integer(args.v[2]);
|
||||
} else {
|
||||
JANET_THROW(args, "expected integer");
|
||||
JANET_ARG_INTEGER(end, args, 2);
|
||||
}
|
||||
if (start < 0) start = len + start;
|
||||
if (end < 0) end = len + end + 1;
|
||||
|
||||
Reference in New Issue
Block a user