Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: arithmetic operator precedence



On 2008-06-19 17:27:18 +0100, Stephane Chazelas wrote:
> Think of:
> 
> double() {
>   REPLY=$(($1 * 2))
> }
> 
> square() {
>   REPLY=$(($1 ** 2))
> }

Why are you so stubborn?

double() {
  REPLY=$((($1) * 2))
}

is the correct way to do and works with 'double 1+1' and so on.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author