zsh-workers
 help / color / mirror / code / Atom feed
* [bug] $((0.5?1+1:3))
@ 2013-04-29  2:00 Stephane Chazelas
  2013-04-29  4:15 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2013-04-29  2:00 UTC (permalink / raw)
  To: Zsh Hackers' List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-29  4:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29  2:00 [bug] $((0.5?1+1:3)) Stephane Chazelas
2013-04-29  4:15 ` Bart Schaefer

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).