From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: [bug] $((0.5?1+1:3))
Date: Mon, 29 Apr 2013 03:00:02 +0100 [thread overview]
Message-ID: <20130429020002.GA7626@chaz.gmail.com> (raw)
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
next reply other threads:[~2013-04-29 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 2:00 Stephane Chazelas [this message]
2013-04-29 4:15 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130429020002.GA7626@chaz.gmail.com \
--to=stephane.chazelas@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).