From: David B. <dbm...@gm...> - 2014-09-01 14:52:34
|
On 31/08/2014 7:28 AM, Robert Dodier wrote: > On 2014-08-30, couraud <l.c...@gm...> wrote: > >> solve(eq, r6); >> >> 1 Enter bfloat [0.0 + 1..#INF00e+000E+2678440] >> >> 2 Enter bfloat [0.0] >> >> 2 Exit bfloat 0.0b0 >> >> 2 Enter bfloat [1..#INF00e+000E+69] >> >> bfloat: attempted conversion of floating-point infinity. > I think what's going on here is that Maxima is attempting to determine > the sign of some constant expression (involving ratios of enormous > integers), and tries to compute a floating point approximation. > I think there is some provision in the code for failure to compute a > float, and then it goes to a bigfloat approximation. That scheme > works OK for Lisp implementations (Clisp, SBCL, Clozure CL) which can't > compute floating point infinity by default, but it fails for those > which do (GCL, ECL) -- after computing floating point infinity, Maxima > tries to convert it to bigfloat (I don't know what's the purpose of > that) and fails. > > The code of interest is in SIGN1 (src/compar.lisp) at lines 1243--1259. > I guess one way to fix it is to account for non-finite floats. > Can someone fix it? > > best > > Robert Dodier Here is a reduced test case. Nothing magic about the constants, they just need to be large. I:87^611$ M:91^211$ sign(sqrt(I)-M); Maxima 5.34post http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) display2d:false; (%o1) false (%i2) trace(?sign1,bfloat); (%o2) [sign1,bfloat] (%i3) I:87^611$ (%i4) M:91^211$ (%i5) sign(sqrt(I)-M); 1 Enter sign1 [87] 1 Exit sign1 pos 1 Enter sign1 [87^(611/2)-227894466256574889420211635345748034449970012014651359835345211477247577813962279418947874919384990943608901614822595179322674507119231045537829696304840485591301824628190054337112380920376337397871582364269303971018654072412430217008671593811253258418371291241902259707966572789245722710797385164506264434277218952320905773492038425282472059016207718540274567812052960443332201900642178741918587353798310622059491] 1 Enter bfloat [9.327379053088815^611] 2 Enter bfloat [9.327379053088815] 2 Exit bfloat 9.327379053088816b0 1 Exit bfloat 3.335275205992107b592 1 Enter bfloat [9.327379053088815^611] 2 Enter bfloat [9.327379053088815] 2 Exit bfloat 9.327379053088816b0 1 Exit bfloat 3.335275205992107b592 1 Enter bfloat [-i.nfE+4445842+3.335275205992107b592] 2 Enter bfloat [-i.nfE+4445842] bfloat: attempted conversion of floating-point infinity. -- an error. To debug this try: debugmode(true); |