about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/math.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b75195a5f..898aef16b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-04-29  Bart Schaefer  <schaefer@zsh.org>
 
+	* 31353: Src/math.c: fix handling of floating point in ternary
+	
 	* 31350: Src/init.c, Src/input.c, Src/signals.h, Src/utils.c,
 	Src/Zle/zle_main.c: block SIGWINCH nearly all the time, except
 	when about to calculate prompts or do synchronous read, so
diff --git a/Src/math.c b/Src/math.c
index a2462a32e..eae283d19 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -1459,7 +1459,8 @@ mathparse(int pc)
 	case QUEST:
 	    if (stack[sp].val.type == MN_UNSET)
 		stack[sp].val = getmathparam(stack + sp);
-	    q = (stack[sp].val.type == MN_FLOAT) ? (zlong)stack[sp].val.u.d :
+	    q = (stack[sp].val.type == MN_FLOAT) ?
+		(stack[sp].val.u.d == 0 ? 0 : 1) :
 		stack[sp].val.u.l;
 
 	    if (!q)