summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-09-17 17:54:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-09-17 17:54:22 -0700
commit9c0649bcfda1277ada69cc6e44f1df926458d922 (patch)
tree1a42978b1b5bea1089e8db38d9a04745be82c527
parent4a5a29a76b8e5aa139209aabe310c2179a60608d (diff)
downloadtxr-9c0649bcfda1277ada69cc6e44f1df926458d922.tar.gz
txr-9c0649bcfda1277ada69cc6e44f1df926458d922.tar.bz2
txr-9c0649bcfda1277ada69cc6e44f1df926458d922.zip
* stream.c (vformat): Slight change in ~s directive. For a floating
point integer, .0 is now always shown if the precision is not given, or if it is given and nonzero. Previous behavior of ~s was add .0 only when a precision is not specified. The new behavior is more sensible and consistent with documentation. * txr.1: Typo fixed in related documentation.
-rw-r--r--ChangeLog10
-rw-r--r--stream.c2
-rw-r--r--txr.12
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c206ba7d..c0d1ac7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-09-17 Kaz Kylheku <kaz@kylheku.com>
+ * stream.c (vformat): Slight change in ~s directive. For a floating
+ point integer, .0 is now always shown if the precision is not given,
+ or if it is given and nonzero. Previous behavior of ~s was add .0 only
+ when a precision is not specified. The new behavior is more
+ sensible and consistent with documentation.
+
+ * txr.1: Typo fixed in related documentation.
+
+2012-09-17 Kaz Kylheku <kaz@kylheku.com>
+
* arith.c (comp_trunc, logcomp): logcomp renamed to lognot,
consistent with Common Lisp.
diff --git a/stream.c b/stream.c
index c430f2ee..1eaafc27 100644
--- a/stream.c
+++ b/stream.c
@@ -1272,7 +1272,7 @@ val vformat(val stream, val fmtstr, va_list vl)
*exp = 0;
}
- if (ch == 's' && !precision_p && !dec && !exp)
+ if (ch == 's' && (!precision_p || precision > 0) && !dec && !exp)
strcat(num_buf, ".0");
}
diff --git a/txr.1 b/txr.1
index a641d91f..5781418c 100644
--- a/txr.1
+++ b/txr.1
@@ -9415,7 +9415,7 @@ semantics. The precision field is treated very similarly to the ~a
format directive, except that non-exponentiated floating point numbers that
would be mistaken for integers include a trailing ".0" for the sake read-print
consistency. Objects truncated by precision may not have read-print
-consitency. For instance, if a string object is truncated, it loses its
+consistency. For instance, if a string object is truncated, it loses its
trailing closing quote, so that the resulting representation is no longer
a properly formed string object.