exact decimal type, was: 12.3*70.95 a little bit weird



On 11/29/11 11:17 PM, Robert Dodier wrote:
> Dan, as others have pointed out, the discrepancy you observed
> stems from floating point numbers being only approximations
> to decimal numbers.
>
> I wonder if it would be worth the trouble to invent an exact
> decimal type for Maxima. One can already get exact arithmetic
> by using fractions, e.g. 123/10 instead of 12.3 or 95/100 instead
> of 0.95, but that's kind of clumsy. How about something like,
> I don't know, 12.3x0 to denote a number exactly equal to 123/10 ?
> Any interest in that?
>
We had discussed this some time ago.  I had proposed 12.3r0, with "r"
for rational.  One issue was that you would enter 12.3r0, but maxima
would print 123/10.  It would be nice if maxima could output 12.3r0
instead.  I guess we could hack the printer to check for rationals and
if the denominator only contained factors of 2 or 5, then something
special could be done.  On the other hand, a user might prefer 123/10.

Ray