printing of floating point numbers and integers in Maxima
Subject: printing of floating point numbers and integers in Maxima
From: Richard Fateman
Date: Wed, 19 Dec 2007 08:46:44 -0800
I think that I could set a flag in displa that nformat notices, that says
"this call to nformat is coming from displa".
This should work unless someone does display (hairy_computation(...
part(..))) , I guess.
Clearly returning "101" for 5 when integerformat is set to "~b" would not
fulfill the "contract" suggested by Stavros.
Any other thoughts?
RJF
_____
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Stavros Macrakis
Sent: Wednesday, December 19, 2007 8:33 AM
To: fateman at EECS.Berkeley.EDU
Cc: maxima at math.utexas.edu
Subject: Re: [Maxima] printing of floating point numbers and integers in
Maxima
On Dec 19, 2007 10:59 AM, Richard Fateman <fateman at cs.berkeley.edu> wrote:
I guess I have to rethink the nformat code, at least with respect to dealing
with numbers.
nformat(ex) must return a valid (though unsimplified) Maxima expression
which simplifies exactly to ex.
This is because it is used by all functions which work on the user-visible
representation of expressions, treating (e.g.) an expression like -(a-1)/b^2
as "-"("//"("-"(a,1),"^"(b,2))) rather than as its internal representation
"*"(-1,"+"(-1,a),"^"(b,-2)).
The affected functions include part, op, substpart, args, reverse, first,
rest, last, map, etc. -- anything affected by inflag.
-s