On Sep 28 2016, "Martens, Tobias" <[email protected]> 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 protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Reply via email to