last bit function ?



Hello,
  Is there a fast  implementation in maxima giving the last bit of a 
float and bfloat?  I am interested in using this to develop a fast and 
accurate interval package.  I have some naive ways to do this, but they 
are very inefficient and give vast overestimation when compared to 
interval packages which exist in C++ and fortran (at least in the double 
precision versions).

    In applications, accuracy is very important.  This is because the 
typical application has a given polynomial p (usually several 
variables), and a given domain D.  One wants a tight enclosure of the 
image p(D).   The procedure to find this is the following.
    Cover the domain by interval boxes and compute an interval enclosure 
of each.  If these enclosures are too big, then subdivide them into 
smaller boxes and compute enclosures of those,   Repeat the process 
until one achieves the desired tight enclosure.
    If the outward roundings are large at each step, then it takes many 
subdivisions (i.e. long computer time) to achieve the goal.

  Let me give an idea of what I have in mind for implementation.

  If we are given two intervals I=[a,b], J=[c,d], then the sum and 
product of I and J are defined to be
          I+J = [a+c,b+d],  I*J = [min(ac,ad,bc,bd), max(ac,ad,bc,bd)]

         Using this with fpprec  arbitrary, and fp = 
2*bloat(10^-fpprec), one can get bfloat bounds for the interval 
operations  by simply doing, say,

        Iplus(I,J,fp) = [a+c -fp*(abs(a+b)), a+c + fp*(abs(a+b))]  (Here 
all numbers are assumed bfloats).

       with similar "outward rounding" for multiplication.  Then, one 
can extend this to operations on polynomials, rational functions, and, 
even the so-called intrinsic functions like sin, cos, exp, log, asin, 
acos, etc.

     The number 2 in the definition of 'fp' might need to be changed to 
4 or 8 to be safe.

    These definitions extended to polynomials, say of degree <= 30,  
turn out to be fairly fast in implementation even for things like fpprec 
= 128, 256, etc.   But, they give large over estimation when compared to 
current implementations of interval arightmetic in other software systems.

   It occurred to me that this might be improved by using last bit 
outward rounding with (hopefully) not much reduction in execution speed.

  Any ideas, suggestions, or comments are welcome.

TIA,
  -sen