rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

uncaught exception on floating point overflow (GCL) #851

Open rtoy opened 1 week ago

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:16 Created by robert_dodier on 2005-06-26 23:24:20 Original: https://sourceforge.net/p/maxima/bugs/760


Using GCL 2.6.6/Maxima 5.9.1cvs. Usually if there is a floating point overflow, Maxima catches the GCL error and returns to the Maxima command prompt after printing an error message. E.g. in a fresh session:

(%i1) 1e300*1e300;

Maxima encountered a Lisp error:

Error in PROGN [or a callee]: Can't print a non-number.

Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i2)

However, sometimes the error is not caught, and instead of getting the Maxima prompt, the user gets the GCL debugger prompt. I've been able to cause this to happen a few times, but the only reproduceable example I have is the following. The example is contained in the attached file musa.mac.

------------------------ begin transcript ------------------------ (%i1) T: matrix ([3, 45, 6, 7, 8]); (%o1) [ 3 45 6 7 8 ] (%i2) t: matrix ([0, 3, 48, 54, 61, 69]); (%o2) [ 0 3 48 54 61 69 ] (%i3) F1(N,F):= 5/N - sum (F*exp(-F*t[1,i])*T[1,i], i, 1, 5); 5 (%o3) F1(N, F) := - - sum(F exp((- F) t ) T , i, 1, 5) N 1, i 1, i (%i4) F2(N,F):= 5/F - sum(N*exp(-F*t[1,i]),i,1,5) + sum(F*N*t[1,i]*exp(-F*t[1,i])*T[1, i],i,1,5) - sum (t[1,i],i,1,5); 5 (%o4) F2(N, F) := - - sum(N exp((- F) t ), i, 1, 5) F 1, i + sum(F N t exp((- F) t ) T , i, 1, 5) 1, i 1, i 1, i - sum(t , i, 1, 5) 1, i (%i5) load (mnewton); (%o5)

/home/robert/tmp/maxima-clean/maxima/share/contrib/mnewton.mac (%i6) mnewton ([F1(N,F), F2(N,F)], [N, F], [1, 1]);

Maxima encountered a Lisp error:

Error in MACSYMA-TOP-LEVEL [or a callee]: Error in PCL::PRINT-STD-INSTANCE [or a callee]: Can't print a non-number.

Fast links are on: do (use-fast-links nil) for debugging Broken at PRINT-OBJECT. Type :H for Help. 1 (Continue) Macsyma top-level 2 (Abort) Return to top level. dbl:MAXIMA>> ---------------------------- end transcript ------------------------

The error appears to be generated by the line

numdet:float(sublis(Solutions,det)),

in mnewton.mac.

See also bug report 781726.

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:17 Created by robert_dodier on 2005-06-26 23:24:20 Original: https://sourceforge.net/p/maxima/bugs/760/#713b


example which shows error

Attachments:

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:21 Created by robert_dodier on 2006-08-12 16:52:58 Original: https://sourceforge.net/p/maxima/bugs/760/#1bef


rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:24 Created by robert_dodier on 2006-08-12 16:52:58 Original: https://sourceforge.net/p/maxima/bugs/760/#d1fc


Logged In: YES user_id=501686

Reported behavior not observed in 5.9.3cvs / GCL 2.6.7. Instead mnewton ([F1(N,F), F2(N,F)], [N, F], [1, 1]); => Maxima encountered a Lisp error:

Error in PROGN [or a callee]: Bind stack overflow.

i.e. different error, and it is caught successfully.

rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:28 Created by robert_dodier on 2006-09-09 01:51:28 Original: https://sourceforge.net/p/maxima/bugs/760/#559f


rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:32 Created by robert_dodier on 2022-11-03 17:41:01 Original: https://sourceforge.net/p/maxima/bugs/760/#4fef


rtoy commented 1 week ago

Imported from SourceForge on 2024-07-03 13:06:35 Created by robert_dodier on 2022-11-03 17:41:02 Original: https://sourceforge.net/p/maxima/bugs/760/#336d


Needs review. Extract example and put into test cases if not there already.