On 2013-12-28, Robert Dodier <robert.dodier at gmail.com> wrote:
> The logic for this stuff is found at lines 315--328 in src/commac.lisp
> (function EXPLODEN). I looked at it for a few minutes but I don't have
> an easy fix.
Here is a simple-minded patch. Comments welcome. It just sticks a "0"
on the result if it starts with ".".
Robert Dodier
PS.
$ git diff src/commac.lisp
diff --git a/src/commac.lisp b/src/commac.lisp
index 7de50f0..55eb973 100644
--- a/src/commac.lisp
+++ b/src/commac.lisp
@@ -325,7 +325,15 @@ values")
(t 1)))))
(t
(values "~ve" (+ 5 effective-printprec))))
- (setq string (format nil form width symb))))
+ (setq string (format nil form width a))
+ ;; Ensure result has a leading zero if it needs one.
+ (if (eq (aref string 0) #\.)
+ (setq string (concatenate 'string "0" string)))
+ ;; EXPLODEN is often called after NFORMAT, so it doesn't
+ ;; usually see a negative argument. I can't guarantee
+ ;; a non-negative argument, so handle negative here.
+ (if (< symb 0)
+ (setq string (concatenate 'string "-" string)))))
(setq string (string-trim " " string))))
((integerp symb)