Stavros Macrakis wrote:
> On Sun, Oct 5, 2008 at 5:10 PM, Thomas Kahl <kahl at math.uminho.pt
> <mailto:kahl at math.uminho.pt>> wrote:
>
> I am a beginner in Maxima. I am using version 5.16.3 (CLISP). Is it
> possible that the function fpprintprec does not what it is supposed
> to do?
>
>
> Thomas, thank you for your interest in Maxima!
>
> Unfortunately, you are right, fpprintprec appears to have a serious bug
> where it omits the final digit of the output (and any preceding 0's):
>
> fpprintprec:5;
>
> 1.01b0 => 1.0b0
> 9.23b0 => 9.2b0
> 1.234b0 => 1.23b0
>
> Could you please report this at Sourceforge? -- follow the instructions
> given by bug_report();
I think I found the problem. Near line 191 in float.lisp, we check for
the end of the output too soon, and always leave off the last digit if
the number of digits is less then fpprintprec. The following diff fixes
the issue.
Ray
Index: float.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/float.lisp,v
retrieving revision 1.41
diff -u -r1.41 float.lisp
--- float.lisp 27 Jul 2008 07:04:08 -0000 1.41
+++ float.lisp 6 Oct 2008 15:06:18 -0000
@@ -191,7 +191,7 @@
(cdr l1))
(t (setq l1 (cdr l1))
(do ((i $fpprintprec (1- i)) (l2))
- ((or (< i 2) (null (cdr l1)))
+ ((or (< i 2) (null l1))
(cond ((not $bftrunc) (nreverse l2))
(t (do ((l3 l2 (cdr l3)))
((not (eq '|0| (car l3)))