printing of floating point numbers and integers in Maxima



I guess I have to rethink the nformat code, at least with respect to dealing
with numbers.
I thought it would be ok to maps integers and floats into strings before
printing them.
apparently many other programs are using nformat, and they break if a number
like 123 is turned
into a string like "123".   Apparently sort calls nformat on its input. The
solution is
probably to be much more cautious about returning strings.  If integerformat
is "~b", we don't really
want part(x^2)  to return "10".

Thanks for trying it out.

RJF

> -----Original Message-----
> From: Barton Willis [mailto:willisb at unk.edu] 
> Sent: Wednesday, December 19, 2007 3:33 AM
> To: fateman at EECS.Berkeley.EDU
> Subject: RE: [Maxima] printing of floating point numbers and 
> integers in Maxima
> 
> A few more bugs from the testsuite (GCL 2.6.8, Maxima 
> 5.13.99rc2, wxMaxima)
> 
> Here we get a list of strings instead of a list of integers:
> 
> (%i17) sort(args(factor(2^63-1)));
> (%o17) [49,127,337,649657,73,92737]
> 
> (%i18) ?print(%);
> (MLIST SIMP) 49 "127" "337" "649657" "73" "92737")
> (%o18) [49,127,337,649657,73,92737]
> 
> (%i19) integrate(x^(5/4)/(1+x)^(5/2),x,0,inf);
> Maxima encountered a Lisp error:
>  Error in NFORMAT [or a callee]: ((RAT) 5 2) is not of type STRING.
> 
> (%i20) funcsolve((1+n)*f(n)-((3+n)*f(1+n))/(1+n)=(n-1)/(2+n),f(n));
> (%o20) f(n)=0
> 
> The result should be log(x/4 - 1/2)
> 
> (%i21) rationalize(log(0.25*x-0.5));
> (%o21) log(0.25*x-0.5)
> 
> Here we get strings instead of integers:
> 
> (%i22) example(solve);
> (%i23) solve(asin(cos("3"*x))*(f(x)-"1"),x)
> (%o23) [x=%pi/6,f(x)=1]
> 
> There might be other bugs that involve part, piece, and friends.
> But maybe all these bugs are due to other bugs.
> 
> Barton
> 
>