Skip to content

Commit

Permalink
labs/fabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Jan 7, 2015
1 parent 19f479f commit 3af0841
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/number.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PN potion_strtod(Potion *P, char *str, int len) {
PN potion_num_pow(Potion *P, PN cl, PN self, PN sup) {
double x = PN_DBL(self), y = PN_DBL(sup);
double z = pow(x, y);
if (PN_IS_INT(self) && PN_IS_INT(sup) && abs(z) < INT_MAX)
if (PN_IS_INT(self) && PN_IS_INT(sup) && fabs(z) < INT_MAX)
return PN_NUM((int)z);
return potion_double(P, z);
}
Expand Down Expand Up @@ -305,7 +305,7 @@ static PN potion_int_to(Potion *P, PN cl, PN self, PN end, PN block) {
potion_fatal("block argument for to is not a closure");
for (i = j; i != k + s; i += s)
PN_CLOSURE(block)->method(P, block, P->lobby, PN_NUM(i));
return PN_NUM(abs(i - j));
return PN_NUM(labs(i - j));
}
/**\memberof PNNumber
from "step" end step: block. call block on each number from self to end
Expand All @@ -324,7 +324,7 @@ static PN potion_int_step(Potion *P, PN cl, PN self, PN end, PN step, PN block)
for (i = PN_INT(self); i <= j; i += k) {
PN_CLOSURE(block)->method(P, block, P->lobby, PN_NUM(i));
}
return PN_NUM(abs(i - j) / k);
return PN_NUM(labs(i - j) / k);
}

/**\memberof PNNumber
Expand Down
2 changes: 1 addition & 1 deletion core/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ PN potion_tuple_slice(Potion *P, PN cl, PN self, PN start, PN end) {
DBG_CHECK_INT(end);
if (e < 0) e = t1->len + e;
l = e - i;
if (l < 0) { i = e; l = abs(l) + 1; }
if (l < 0) { i = e; l = labs(l) + 1; }
else l++;
if (l > t1->len) l = t1->len; // permit overshoots
}
Expand Down

0 comments on commit 3af0841

Please sign in to comment.