a .. b



What does matlab do?

For lo .. h .. hi, the code does (the number of terms is n + 1.

    (setq sgn (if (like hi lo) '$zero (csign (sub hi lo))))
    (setq sgn-h (csign h))
    (setq n (if (eq sgn '$zero) 0 (take '($floor) (div (sub hi lo) h))))

(There is a earlier trap for h == 0.) So

 (%i20) 2.0^55 .. 2.0^55 + 4;
 (%o20) [3.6028797018963968*10^+16]
 (%i21) 2.0^53 .. 2.0^53 + 2;
 (%o21) [9.007199254740992*10^+15,9.007199254740992
 *10^+15,9.007199254740994*10^+15

Maybe Maxima users know that all things float are risky:

 (%i8) ratprint : false$
 (%i9) integrate(x^sqrt(3.0),x,-1,0), ratepsilon : 1.0e-10;
 (%o9) 40545/110771

 (%i10) integrate(x^sqrt(3.0),x,-1,0), ratepsilon : 1.0e-15;
 (%o10) -21489003/58709048

 (%i11) float(rectform(integrate(x^sqrt(3),x,-1,0)));
 (%o11) 0.24382084028492-0.27299449455679*%i


Barton

-----maxima-bounces at math.utexas.edu wrote: -----


>I wonder what the right thing to do about possible round-off errors in
>a..b is.