diff options
Diffstat (limited to '')
-rw-r--r-- | miscutils/bc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index ae5105b01..8cd67b0f5 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -2095,8 +2095,10 @@ static FAST_FUNC BC_STATUS zbc_num_p(BcNum *a, BcNum *b, BcNum *restrict c, size | |||
2095 | size_t i, powrdx, resrdx; | 2095 | size_t i, powrdx, resrdx; |
2096 | bool neg; | 2096 | bool neg; |
2097 | 2097 | ||
2098 | // GNU bc does not allow 2^2.0. We do. | 2098 | // GNU bc does not allow 2^2.0 - we do |
2099 | // if (b->rdx) RETURN_STATUS(bc_error("non integer number")); | 2099 | for (i = 0; i < b->rdx; i++) |
2100 | if (b->num[i] != 0) | ||
2101 | RETURN_STATUS(bc_error("not an integer")); | ||
2100 | 2102 | ||
2101 | if (b->len == 0) { | 2103 | if (b->len == 0) { |
2102 | bc_num_one(c); | 2104 | bc_num_one(c); |
@@ -2505,7 +2507,7 @@ static BC_STATUS zdc_num_modexp(BcNum *a, BcNum *b, BcNum *c, BcNum *restrict d) | |||
2505 | if (c->len == 0) | 2507 | if (c->len == 0) |
2506 | RETURN_STATUS(bc_error("divide by zero")); | 2508 | RETURN_STATUS(bc_error("divide by zero")); |
2507 | if (a->rdx || b->rdx || c->rdx) | 2509 | if (a->rdx || b->rdx || c->rdx) |
2508 | RETURN_STATUS(bc_error("non integer number")); | 2510 | RETURN_STATUS(bc_error("not an integer")); |
2509 | if (b->neg) | 2511 | if (b->neg) |
2510 | RETURN_STATUS(bc_error("negative number")); | 2512 | RETURN_STATUS(bc_error("negative number")); |
2511 | 2513 | ||