Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: arithmetic operator precedence
- X-seq: zsh-workers 25218
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: arithmetic operator precedence
- Date: Thu, 19 Jun 2008 18:10:56 +0200
- 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:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=8kToD8ZV6Y1cJR8qd3uFe9F8uPUO7gSsVArb5cNWHAQ=; b=TOBpAuXNkwHcI8v5VTTqOsqJ1m8AAB9M8vha87thtCdafKZAVgfRRovMLiAWeJrmFX C9HRvo3znI7hoiXdL53xGQLnsMCI3aklAqYLNoz2rcNe7Vw5b7nmJKjVcEXlah9dA6a0 vC0lQNNs8ON2DDDhFY8Wgn6rPu2vZtrRTFaFE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=SdaSPNzCoSkLnuFTi861zHCecfPsnAo/i0REcp/Dz46wWot7KAX9PZ0TGkKrM0Voj7 OkkMJxqX7wMbMKb6vOx+GTgLgPR3YntgwPpb4ErslrixXfgSHH09mjrOBpLCkA4YfWN7 zLgy9iKOZbgp0eCeNCd0spDIQGTOT5HbELALk=
- In-reply-to: <20080619160433.GL10734@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <2d460de70806170219k12ff4cadn441b52c48bf8076f@xxxxxxxxxxxxxx> <2d460de70806170324o5a44609x9383cc2445d67dd6@xxxxxxxxxxxxxx> <20080617103829.GD5016@xxxxxxxxxxxxxxx> <20080617114340.398c731f@news01> <20080617112815.GF10734@xxxxxxxxxxxxxxxxxxx> <200806171146.m5HBkhfR013230@xxxxxxxxxxxxxx> <a0600102dc47fd2c6184e@xxxxxxxxxxxxxxxxx> <200806190958.m5J9w7BJ006695@xxxxxxxxxxxxxx> <2d460de70806190529p1255b8b5mfe2fb2c1e1d7ba35@xxxxxxxxxxxxxx> <20080619160433.GL10734@xxxxxxxxxxxxxxxxxxx>
2008/6/19 Vincent Lefevre <vincent@xxxxxxxxxx>:
> On 2008-06-19 14:29:03 +0200, Richard Hartmann wrote:
>> On Thu, Jun 19, 2008 at 11:58, Peter Stephenson <pws@xxxxxxx> wrote:
>> > That seems a good idea in any case.
>>
>> Can you add that this is done to remain both backwards and shell-
>> compatible and that this is not what a 'real' language/calculator
>> will do?
>
> This isn't shell-compatible. AFAIK, only bash and ksh93 support **.
>
>> Perhaps even include a reference to the POSIX argument.
>
> There's no POSIX argument. ** is just an extension.
I've followed this discussion, and I'm left wondering only one thing.
If it's decided that $(( -1 ** 2 )) == 1, then what's the point? Why
would anyone ever write that? Why require everyone to write -(1**2) when
the expression makes no sense at all without the parentheses? Ie you would
just write 1**2 without the - at all, nobody would ever write (-1)**2.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author