about summary refs log tree commit diff
path: root/Src/math.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2013-03-05 20:04:53 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2013-03-05 20:04:53 +0000
commit3def943d046ad03540dd188ab52c0eacaa021149 (patch)
treea83ffc396543f3da78f3edef865e7094bea9f068 /Src/math.c
parentac22eab0d9ec3d12271a8c80c633716850e3b349 (diff)
downloadzsh-3def943d046ad03540dd188ab52c0eacaa021149.tar.gz
zsh-3def943d046ad03540dd188ab52c0eacaa021149.tar.xz
zsh-3def943d046ad03540dd188ab52c0eacaa021149.zip
users/17665: add FORCE_FLOAT option
Diffstat (limited to 'Src/math.c')
-rw-r--r--Src/math.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/math.c b/Src/math.c
index e90d6a59a..f8a4eefeb 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -456,6 +456,11 @@ lexconstant(void)
 	    yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1);
 	    /* Should we set lastbase here? */
 	    lastbase = 16;
+	    if (isset(FORCEFLOAT))
+	    {
+		yyval.type = MN_FLOAT;
+		yyval.u.d = (double)yyval.u.l;
+	    }
 	    return NUM;
 	}
 	else if (isset(OCTALZEROES))
@@ -475,6 +480,11 @@ lexconstant(void)
 	    {
 		yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1);
 		lastbase = 8;
+		if (isset(FORCEFLOAT))
+		{
+		    yyval.type = MN_FLOAT;
+		    yyval.u.d = (double)yyval.u.l;
+		}
 		return NUM;
 	    }
 	    nptr = ptr2;
@@ -537,6 +547,11 @@ lexconstant(void)
 	    lastbase = yyval.u.l;
 	    yyval.u.l = zstrtol_underscore(ptr, &ptr, lastbase, 1);
 	}
+	if (isset(FORCEFLOAT))
+	{
+	    yyval.type = MN_FLOAT;
+	    yyval.u.d = (double)yyval.u.l;
+	}
     }
     return NUM;
 }