From: Laurent Mazet Date: Mon, 13 Feb 2023 14:17:31 +0000 (+0100) Subject: correct stack order conditions X-Git-Tag: v1.1~3^2~8^2~1 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=dd32032c94021f23838645d6ff76a4ef64d5e29e;p=calc.git correct stack order conditions --- diff --git a/stack.c b/stack.c index a355fa5..081023f 100644 --- a/stack.c +++ b/stack.c @@ -124,12 +124,7 @@ double min () void order () { - int n = size_tab (stack); - if (n < 3) { - VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", n)); - } else { - order_tab (stack); - } + order_tab (stack); } double median () diff --git a/tabular.c b/tabular.c index 0252a8e..a7916a4 100644 --- a/tabular.c +++ b/tabular.c @@ -154,8 +154,8 @@ double pop_tab (tab_t *tab, int id) void order_tab (tab_t *tab) { int i, j; - if ((!tab) || (tab->size < 3)) { - VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", tab->size)); + if ((!tab) || (tab->size < 2)) { + VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", (tab) ? tab->size : 0)); return; }