Change boolean not operator to have same prec as negate
This is to simplify parsing. Also, afl found cases where improper use
would crash the bc.
diff --git a/src/num.c b/src/num.c
index eaeda28..81efb8a 100644
--- a/src/num.c
+++ b/src/num.c
@@ -84,15 +84,15 @@
if (!a) return !b ? 0 : !b->neg * -2 + 1;
else if (!b) return a->neg * -2 + 1;
+ if (!a->len) return (!b->neg * -2 + 1) * !!b->len;
+ else if (!b->len) return a->neg * -2 + 1;
+
if (a->neg) {
if (b->neg) neg = -1;
else return -1;
}
else if (b->neg) return 1;
- if (!a->len) return (!b->neg * -2 + 1) * !!b->len;
- else if (!b->len) return a->neg * -2 + 1;
-
a_int = BC_NUM_INT(a);
b_int = BC_NUM_INT(b);
a_int -= b_int;