Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[bug] $((0.5?1+1:3))



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