9 Ocak 2021 Cumartesi tarihinde Hyunho Cho <mug...@gmail.com> yazdı:
>
> i have tested below in gnome calculator, Qalculate, gawk, perl
> and all results in -4 but bash is 4
>
> $ awk 'BEGIN { print -2 ^ 2 }'
> -4
>
> $ perl -E 'say -2 ** 2'
> -4
>
> $ echo $(( -2 ** 2 ))                     # only bash results in 4
> 4
>

`bc' does that too. Here's another trivial side effect of implementing
unary minus using binary minus:

    $ echo $((16#-10))
    -10
    $ echo $((-16#10))
    -16


-- 
Oğuz

Reply via email to