bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Arithmetic pow results incorrect in arithmetic expansion.


From: Hyunho Cho
Subject: Arithmetic pow results incorrect in arithmetic expansion.
Date: Sat, 9 Jan 2021 13:19:59 +0900

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:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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 }'
-4

$ perl -E 'say -2 ** 2'
-4

$ echo $(( -2 ** 2 ))                     # only bash results in 4
4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]