aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/expressions.c4
-rw-r--r--tests/testsuite.at1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/expressions.c b/src/expressions.c
index de256df..a5a72ce 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -578,7 +578,9 @@ teco_expressions_format_float(gchar *buffer, teco_float_t number, guint precisio
* On the other hand, this prints a fixed number of trailing zeros, so we
* strip these afterwards.
*/
- while (p > buffer && (p[-1] == '0' || p[-1] == '.'))
+ while (p > buffer && p[-1] == '0')
+ p--;
+ if (p > buffer && p[-1] == '.')
p--;
*p = '\0';
return buffer;
diff --git a/tests/testsuite.at b/tests/testsuite.at
index ff6f509..c748086 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -56,6 +56,7 @@ TE_CHECK([[-@0ffffffffffffffffff$]], 1, ignore, ignore)
# NOTE: %q does not change the register's number type.
TE_CHECK([[1.Ua 0.1%a:=]], 0, [1.1], ignore)
TE_CHECK([[1Ua 0.1%a:=]], 0, [1], ignore)
+TE_CHECK([[100.0:=]], 0, [100], ignore)
TE_CHECK([[23.04:=]], 0, [23.04], ignore)
TE_CHECK([[0.04:=]], 0, [0.04], ignore)
TE_CHECK([[23.04#0:=]], 0, [23], ignore)