bug-bash
[Top][All Lists]
Advanced

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

Re: Exponentiation operator


From: Chet Ramey
Subject: Re: Exponentiation operator
Date: Thu, 03 Mar 2005 09:42:45 -0500
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

sanchis@iut-rodez.fr wrote:
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -I.  -I../bash -I../bash/include 
-I../bash/lib  -g -O2
uname output: Linux jade 2.6.8-2-686-smp #1 SMP Mon Jan 24 02:32:52 EST 2005 
i686 GNU/Linux
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        A syntax error with the expression : a**b**c
        What is the associativity of the exponentiation operator ?

Repeat-By:

$ echo $((2**3**2))
bash: 2**3**2: syntax error in expression (error token is "**2")

I made the ** operator associative between bash-2.05b and bash-3.0,
but made it left associative like the rest of the binary operators.
It's more mathematically correct to make it right-associative, so
bash-3.1 will do that.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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