Subject: Maxima gives incorrect results with ceiling
From: Daniel Lakeland
Date: Fri, 7 Dec 2007 13:36:02 -0800
On Fri, Dec 07, 2007 at 04:10:35PM -0500, Stavros Macrakis wrote:
> On Dec 7, 2007 3:30 PM, Daniel Lakeland <dlakelan at street-artists.org> wrote:
>
> > A proposal for the method of doing ceiling and floor with exact
> > results:
> >
> > ...first bfloat the input to whatever the current precision is.
>
>
> I don't see how any method starting like this can possibly work;
> cancellation may make the result much smaller than any intermediate results.
Well, it seems as if this is the starting point of the current
method. I guess I'm suggesting a refinement of the current method
which might have better properties, if not perfect ones.
The other option is to double the precision and recalculate, until the
abs error between successive values is smaller than 1. This is I think
an expensive proposition though. perhaps we could try my first
suggestion (ie. try to zap to the correct precision directly), and
then finally double the precision and see if the answer changes. IF it
does, keep doubling until it doesn't change, with a limit to the
number of doublings... throw an error if the limit is exceeded.
I don't have a proof, but it seems as if it should be the case that
for SOME bf precision, numerical cancellation should cease to be a
problem for calculating the integer part of a bf. The doubling
strategy should find that bf precision in log(n) time, and the "jump
to it" strategy should work in constant time for any case where
cancellation is not a major issue.
--
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan