On 1/9/21 12:22 AM, Oğuz wrote:
Here's another trivial side effect of implementing
unary minus using binary minus:
$ echo $((16#-10))
-10
Since `-' is an operator, this is not unary minus. It's the same as
$(( 16# - 10 )), which bash before version 5.1 helpfully (or not) treats
iden
On 1/8/21 11:19 PM, Hyunho Cho wrote:
Bash Version: 5.0
Patch Level: 17
Release Status: release
i have tested below in gnome calculator, Qalculate, gawk, perl
and all results in -4 but bash is 4
$ awk 'BEGIN { print -2 ^ 2 }
9 Ocak 2021 Cumartesi tarihinde Ilkka Virta yazdı:
>
> Note that binary minus doesn't really compare here. It has a lower
> precedence, so gives a different result:
>
Yes, you are right, and not only that, but the example I gave doesn't even
work on 5.1.
$ (( 16#-10 ))
bash: ((: 16#: invalid
On Sat, Jan 9, 2021 at 9:14 AM Robert Elz wrote:
> Not "all" other shells, most don't implement exponentiation at all,
> since it isn't a standard C operator.
>
Which also means that the statement about the operators being "same as in
the C language" doesn't really help figure out how this parti
On Sat, Jan 9, 2021 at 7:22 AM Oğuz wrote:
> 9 Ocak 2021 Cumartesi tarihinde Hyunho Cho yazdı:
> > $ 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:
>
Note that bina
Date:Sat, 9 Jan 2021 14:45:49 +0900
From:Hyunho Cho
Message-ID:
| I didn't know that all other shells work the same.
Not "all" other shells, most don't implement exponentiation at all,
since it isn't a standard C operator.
Just the ones that happen to implement
I didn't know that all other shells work the same.
Thanks for the clarification.
2021년 1월 9일 (토) 오후 2:29, Lawrence Velázquez 님이 작성:
> > On Jan 8, 2021, at 11:19 PM, Hyunho Cho wrote:
> >
> > Machine: x86_64
> > OS: linux-gnu
> > Compiler: gcc
> > Compilation CFLAGS: -g -O2
> > -fdebug-prefix-
> On Jan 8, 2021, at 11:19 PM, Hyunho Cho wrote:
>
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2
> -fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=.
> -fstack-protector-strong -Wformat -Werror=format-security -Wall
> -Wno-parentheses -Wno-format-security
> uname ou
9 Ocak 2021 Cumartesi tarihinde Hyunho Cho 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
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux EliteBook 5.4.0-42-generic #46-Ubuntu SMP Fri Jul
10 00:2
10 matches
Mail list logo