diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pile.c | 16 | ||||
-rw-r--r-- | lib/scalaires.c | 5 |
2 files changed, 14 insertions, 7 deletions
@@ -459,14 +459,18 @@ void act_pile(int func) _ ("act_pile: OP_FUNC_CALL need only one argument for a polynom evaluation")); } - if (operande[0].poly->degre == 0) { - push_pile_poly(ply_constr - (ply_valuation(operande2.poly, operande[0].poly->coef), 0)); - if (operande[0].poly) + if (operande[0].poly) { + if (operande[0].poly->degre == 0) { + push_pile_poly(ply_constr + (ply_valuation(operande2.poly, operande[0].poly->coef), 0)); ply_destruct(operande[0].poly); - ply_destruct(operande2.poly); + ply_destruct(operande2.poly); + } else { + exception(1, _("act_pile: OP_FUNC_CALL incorrect value for 2nd arg")); + } } else { - exception(1, _("act_pile: OP_FUNC_CALL incorrect value for 2nd arg")); + push_pile_poly(ply_constr(ply_valuation(operande2.poly, rat_constr_zero()), 0)); + ply_destruct(operande2.poly); } } else { exception(1, _("act_pile: OP_FUNC_CALL arg2 is an empty polynom")); diff --git a/lib/scalaires.c b/lib/scalaires.c index b0e9396..7240543 100644 --- a/lib/scalaires.c +++ b/lib/scalaires.c @@ -158,7 +158,10 @@ rationnel rat_pow(rationnel rat, unsigned int p) { /* * puissance */ - for (; p; p--) { + if (p == 0) { + return rat_constr(1, 1); + } + for (p--; p; p--) { rat = rat_multiplication(rat, rat); } return rat; |