Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: arithmetic operator precedence
- X-seq: zsh-workers 25169
- From: "Richard Hartmann" <richih.mailinglist@xxxxxxxxx>
- To: "Peter Stephenson" <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: arithmetic operator precedence
- Date: Tue, 17 Jun 2008 11:19:40 +0200
- Cc: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=vDzmrCRrJRrNypawRpqU5t28gGQvGLXtWkrR13UrEAA=; b=avdJJOJ1VwH7Ej6pWe6TaNeCHZOsxsFJUYhJzq4ayg/h1OZ36K0g5LLwkcS0f40JJK Pc6YRaiuj6T99/4TJpqsJA76AmIIng6qCtyiaepr9iV+dldDPDrLtT+ttxlXdTxs+HcC A9prA+C0UWL/1A1UcpCbp6gN03buW4Flo4egA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=YcJjboIzlRtiSwwku4L8CVvQbH9xIxTIu1ePnCiyMU8HwpAodLupqdrsk794h8rOJO XTNjvm88Rck+3FTGntwI9O2KDF8k+Kra7pvE06mQV6IgiHA9RClTC6Ys6LzA5tkECnGc ZD0QEpoJozLIV94UlyfRba8L6AuQU40K4nSwY=
- In-reply-to: <20080616144211.276fb0e3@pws-pc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080612095723.GF5113@xxxxxxxxxxxxxxx> <20080616080726.GP10734@xxxxxxxxxxxxxxxxxxx> <20080616144211.276fb0e3@pws-pc>
On Mon, Jun 16, 2008 at 15:42, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> That's an interesting point for C_PRECEDENCES since I was trying to get
> it behave as much as possible like Perl. What does anyone else think?
Being unsure myself, I did some somewhat extensive research. The only
mathematically correct way of doing this is
-3**2 = -9
(-3)**2 = 9
On the other hand, compability with the other shells is A Good Thing,
especially as this is the kind of syntax change that can break a script
in a very, very evil and hard-to-debug way.
Still, all things considered, I would say the only possible way to go is to
use the mathematically correct syntax. Both options are bad, in a way,
but this is the better one.
Richard
Messages sorted by:
Reverse Date,
Date,
Thread,
Author