bc: fix comparison bug, closes 12336
No binary (build failed)
—
(log yok)
| @@ -1465,7 +1465,10 @@ static ssize_t bc_num_cmp(BcNum *a, BcNum *b) | |
| b_int = BC_NUM_INT(b); | |
| a_int -= b_int; | |
| - | if (a_int != 0) return (ssize_t) a_int; |
| + | if (a_int != 0) { |
| + | if (neg) return - (ssize_t) a_int; |
| + | return (ssize_t) a_int; |
| + | } |
| a_max = (a->rdx > b->rdx); | |
| if (a_max) { | |
| @@ -187,6 +187,11 @@ testing "bc { print 1 }" \ | |
| "1" \ | |
| "" "{ print 1 }" | |
| + | testing "bc comparison 1" \ |
| + | "bc" \ |
| + | "1\n" \ |
| + | "" "-10 < -9" |
| + | |
| testing "bc nested loops and breaks" \ | |
| "bc" \ | |
| "\ | |