My mail below is apparently wrong, because float to bfloat conversion is now
more clever than originally programmed (by me, in 1974 or so).
That is, it appears floating point numbers are converted to nearby rationals
and then converted to bfloats. Thus bfloat(float(1/3)) is rather close to
1/3, regardless of fpprec, instead of being random=looking after about 16
decimal digits [if double float is used].
Compare, however,
bfloat(%pi)
And bfloat(ev(%pi,numer));
The first of these is good to fpprec places. The second is good to 16 places
only.
RJf
> -----Original Message-----
> From: maxima-admin at math.utexas.edu [mailto:maxima-admin at math.utexas.edu]
> On Behalf Of Richard Fateman
> Sent: Tuesday, August 01, 2006 8:27 AM
> To: sen1 at math.msu.edu; maxima at math.utexas.edu
> Subject: RE: [Maxima] High precision
>
> Numbers which are introduced as ordinary machine floats like 1.0 are
> forever
> machine floats unless you explicitly convert them. If they are introduced
> as bigfloats, say as 1.0b0, then they will be bigfloats. The next time
> they
> are operated on, the result of the calculation will have precision fpprec.
>
> Oh, integers are left alone as integers, similarly for rationals.
> What you can sometimes do is,
>
> Myprogram(a,b,c):= (a:bfloat(a), b:bfloat(b), c:bfloat(c), .....);
>
> This is will convert a,b,c to bigfloats of the current fpprec. If they are
> already bigfloats, the cost is negligible.
>
> Oh, maybe your issue is this... if you type this: bfloat(0.1);
> Then the error in 0.1 as a single float will still be there, since that is
> the value you put in to the program. Converting it to bigfloat afterward
> means that the conversion from 1/10 to a binary number has been done to
> machine precision, and in binary. Thus inexactly. Compare to bfloat(1/10)
> or 0.1b0 which may have the accuracy you expect. Not all functions have
> bfloat versions so they have to convert to something they know, like
> double
> precision, and then do the calculation.
> Feel free to contribute bfloat versions of numerical functions :)
>
> RJF
>
>
>
> > -----Original Message-----
> > From: maxima-admin at math.utexas.edu [mailto:maxima-admin at math.utexas.edu]
> > On Behalf Of sen1 at math.msu.edu
> > Sent: Tuesday, August 01, 2006 7:49 AM
> > To: maxima at math.utexas.edu
> > Subject: High precision
> >
> > Hello,
> > I would like to run certain entire maxima sessions in high precision
> > arithmetic.
> >
> > I have tried setting fpprec: 32.
> >
> > The numbers get listed as having that precision. But, it seems that
> > floating point errors I expect from functions with standard double
> > precision are still there. Does every single variable in an
> > expression have to be converted?
> >
> > Is it expected that, once one sets fpprec: 32, all further
> > computations, even with previously defined functions, will be at that
> > precision?
> >
> > Thanks for any info.
> >
> > -sen
> >
> > --
> > ----------------------------------------------------------------------
> --
> > ---
> > | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu
> > |
> > | Mathematics Department | |
> > | Michigan State University | telephone: 517-355-9684
> > |
> > | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562
> > |
> > ----------------------------------------------------------------------
> --
> > ---
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima