about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-01-10 10:55:20 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-01-10 10:55:20 +0000
commit324e26d8ceb08ea907c686265f2b51bbc8232cff (patch)
tree39679daefe59a0bb60266d6bd5ae58f32182bfd2
parent99d54b0b70f19d3e08f3b8f124a1feec065488f2 (diff)
downloadzsh-324e26d8ceb08ea907c686265f2b51bbc8232cff.tar.gz
zsh-324e26d8ceb08ea907c686265f2b51bbc8232cff.tar.xz
zsh-324e26d8ceb08ea907c686265f2b51bbc8232cff.zip
16423: append a `.' to converted floating point output
to stop it looking like an integer
-rw-r--r--ChangeLog7
-rw-r--r--Src/params.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d12dcd643..b7bf30788 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-10  Peter Stephenson  <pws@csr.com>
+
+	* 16423: Src/params.c: Don't let convfloat output a number
+	looking like an integer; append a `.' if necessary.  Otherwise
+	the wrong type of arithmetic will be used on numbers stored in
+	scalars.
+
 2002-01-09  Peter Stephenson  <pws@csr.com>
 
 	* 16422: Functions/Misc/zcalc: fix output in bases when
diff --git a/Src/params.c b/Src/params.c
index 1a04d7904..8db358b07 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3357,6 +3357,8 @@ convfloat(double dval, int digits, int flags, FILE *fout)
     } else {
 	VARARR(char, buf, 512 + digits);
 	sprintf(buf, fmt, digits, dval);
+	if (!strchr(buf, 'e') && !strchr(buf, '.'))
+	    strcat(buf, ".");
 	return dupstring(buf);
     }
 }