Subject: bug#24561: Unmathematical bc exponentiation behavior

From: Andreas Schwab <[email-masked]>
Date: Wed, 28 Sep 2016 20:10:15 +0200

On Sep 28 2016, "Martens, Tobias" <[email-masked]> wrote:

> echo "-(1)^2" | bc
> 1
>
> I would have expected -1. This behavior is unmathematical and very confusing, because otherwise bc acts quite logic.
> Not sure if it is mandated by POSIX

Unary - has higher precedence than ^, thus it is parsed as (-(1))^2.

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."