I am trying values of x a little less than 1
by subtracting 10^(-j) from 1 and then
trying to evaluate a function of two exponentials.
In the first example (which hangs), I am using
bfloat with a local setting of fpprec.
Maxima 5.17.1 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL)
(%i1) display2d:false$
(%i2) h(xx) := exp(-(xx+1)/4 )/4 + exp( -1/(1-xx))/(1-xx)^2$
(%i3) h(0.9);
(%o3) 0.1600112570925
(%i4) g(j,fp) := block([fpprec,x,y],
fpprec:fp,
y : bfloat(10^(-j)),
x : bfloat(1-y),
print(j,y,x),
bfloat(h(x)) )$
(%i5) g(7,40);
7 1.0b-7 9.999999b-1
(%o5) 1.516326687189750264901169661977624778275b-1
(%i6) g(8,40);
8 1.0b-8 9.9999999b-1
At this point, the computer hangs and I can only restart
(windows xp, max 5.17.1).
However if I do the same evaluation using default floating point precision
without bfloat(...)'s, Maxima has no problem getting the function
evaluated.
(%i1) display2d:false$
(%i2) h(xx) := exp(-(xx+1)/4 )/4 + exp( -1/(1-xx))/(1-xx)^2$
(%i3) gg(j ) := block([x,y],
y : float(10^(-j)),
x : float(1-y),
print(j,y,x),
float(h(x)) )$
(%i4) fpprec;
(%o4) 16
(%i5) gg(7);
7 9.9999999999999995E-8 0.9999999
(%o5) 0.15163266871898
(%i6) gg(8);
8 1.0E-8 0.99999999
(%o6) 0.15163266530724
So is this a bug in bfloat?
Ted Woollett