fpplus issue (Re: [Maxima] float(%e^%e))



>>>>> "Raymond" == Raymond Toy <toy@rtp.ericsson.se> writes:

>>>>> "Raymond" == Raymond Toy <toy@rtp.ericsson.se> writes:
    Raymond> After some experimentation, here is a possible fix to make both of
    Raymond> these work again:

    Raymond> (defun fpshift (l n) 
    Raymond>   (cond ((null *decfp)
    Raymond> 	 (cond ((and (minusp n) (minus l))
    Raymond> 		;; Left shift of negative number requires some
    Raymond> 		;; care?  If the shift of the positive number would
    Raymond> 		;; have returned 0, return 0.  Otherwise, return the
    Raymond> 		;; negative of the shifted number.  (That is,
    Raymond> 		;; (truncate l (expt 2 n))).
    Raymond> 		(let ((s (ash (- l) n)))
    Raymond> 		  (if (zerop s)
    Raymond> 		      0
    Raymond> 		      (- s))))
    Raymond> 	       (t
    Raymond> 		(ash l n))))
    Raymond> 	((greaterp n 0.) (times l (expt 10. n)))
    Raymond> 	((lessp n 0.) (quotient l (expt 10. (minus n))))
    Raymond> 	(t l)))

After some more thought, I think this is the correct solution.  Well,
except for the goofy implementation and the typo (minus l). :-)

I'll check in cleaner version, shortly.  I also have a small
improvement to fplog.  It was multiplying by 2 inside the main loop.
I just lifted that outside the loop.  Speeds up bigfloat logs by a
factor of 1.5 or so, at least for the one test case I used.

Ray