bc: do not yet allow 2^2.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a9f59db809
commit
1acac7f9c5
@ -2095,8 +2095,10 @@ static FAST_FUNC BC_STATUS zbc_num_p(BcNum *a, BcNum *b, BcNum *restrict c, size
|
|||||||
size_t i, powrdx, resrdx;
|
size_t i, powrdx, resrdx;
|
||||||
bool neg;
|
bool neg;
|
||||||
|
|
||||||
// GNU bc does not allow 2^2.0. We do.
|
// GNU bc does not allow 2^2.0 - we do
|
||||||
// if (b->rdx) RETURN_STATUS(bc_error("non integer number"));
|
for (i = 0; i < b->rdx; i++)
|
||||||
|
if (b->num[i] != 0)
|
||||||
|
RETURN_STATUS(bc_error("not an integer"));
|
||||||
|
|
||||||
if (b->len == 0) {
|
if (b->len == 0) {
|
||||||
bc_num_one(c);
|
bc_num_one(c);
|
||||||
@ -2505,7 +2507,7 @@ static BC_STATUS zdc_num_modexp(BcNum *a, BcNum *b, BcNum *c, BcNum *restrict d)
|
|||||||
if (c->len == 0)
|
if (c->len == 0)
|
||||||
RETURN_STATUS(bc_error("divide by zero"));
|
RETURN_STATUS(bc_error("divide by zero"));
|
||||||
if (a->rdx || b->rdx || c->rdx)
|
if (a->rdx || b->rdx || c->rdx)
|
||||||
RETURN_STATUS(bc_error("non integer number"));
|
RETURN_STATUS(bc_error("not an integer"));
|
||||||
if (b->neg)
|
if (b->neg)
|
||||||
RETURN_STATUS(bc_error("negative number"));
|
RETURN_STATUS(bc_error("negative number"));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user