Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[bug] $((0.5?1+1:3))
- X-seq: zsh-workers 31352
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: [bug] $((0.5?1+1:3))
- Date: Mon, 29 Apr 2013 03:00:02 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:mail-followup-to :mime-version:content-type:content-disposition:user-agent; bh=JPsBoO6F9ttomp9cPBeVOECwR3Xn6PuWsXBdLaA3t54=; b=XvKiKqU4XeccdF9L/dy+rw0qnF82LQUdzXctvG5ZAGdqiE/pr1PwkgSkc7ZObmBt8v AbM4Ry3SifBdnZfpK+ZyXLdhYYFY6m3i6CKmYO3qlWCRT3e/eD6hBRNa7iixnMLonywx i3hoWZ2cCs11A/5KuTmnrtnIZ6ro/XibnirsAapnSL5T9OuTd25I2oV7e2ducgwUMhxw Gk0NS0io8hDtCJMRWl3frakKHDENOYArVZdm9IDkCX+kTqw1sVWl2NzU9kK660V646DF en4TU+hdMjoBgPSs80BtN8zWfu6RQrY5fG1JJBAPLf0xvLzTdxcFN0J++Vaod1NE0v9g kUCQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
That's quite an odd one. For any value of x between -1 and 1
(-1, 1 and 0 excluded), $(( x ? <some-expression> : 42 )) where
<some-expression> is anything but a numeric constant, expands to
"0".
OK$ echo $((0.5?2:3))
2
NOK$ echo $((0.5?1+1:3))
0
OK$ echo $((1.1?2:3))
2
$ echo $ZSH_VERSION
5.0.2
(debian 7 amd64)
Work around is to write it $(( 0.5 != 0 ? 1+1 : 3 )) (since 0.5
!= 0 then has a value of 1 which falls outside that range I
suppose).
regards,
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author