From 1c20afc6bfdbdc24fc59e68d3095ce6141c84cd6 Mon Sep 17 00:00:00 2001 From: Pixel Date: Thu, 3 May 2001 02:00:48 +0000 Subject: Hop --- lib/pile.c | 16 ++++++++++------ lib/scalaires.c | 5 ++++- src/Polynom.c | 5 +++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/pile.c b/lib/pile.c index 6298b92..1f98941 100644 --- a/lib/pile.c +++ b/lib/pile.c @@ -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; diff --git a/src/Polynom.c b/src/Polynom.c index a80cafd..80e4448 100644 --- a/src/Polynom.c +++ b/src/Polynom.c @@ -75,8 +75,9 @@ int main(int argc, char **argv) invite(); - signal(SIGSEGV, segfaulthand); - signal(SIGINT, ctrlbreakhand); + /* + * signal(SIGSEGV, segfaulthand); signal(SIGINT, ctrlbreakhand); + */ fprintf(stderr, _("\nPerforming initialisation...\n\n")); init_all(argv[1]); -- cgit v1.2.3