These are not small floating point errors, but rather large ones. Of course it depends on whether you are looking at the number of significant places in agreement or the number in disagreement:)
I would guess that one is using single precision IEEE floats and the other is using double precision. It could very well be that your m68k is getting better answers.
I think the CL standard allows one to implement single-float as the same as double-float. A test would be to see for what value of n 1.0+2^(-n) = 1.0 e.g.
for i:1 thru 60 do print ([i,is (1.0d0=1.0d0+2^(-i))]); double for i:1 thru 60 do print ([i,is (1.0=1.0+2^(-i))]); single
for the first one, you should get i=22 for the first true. for the second one, i=53 should be the first true.
The way I debug lisp functions is first to make sure the same answer happens when the code is interpreted rather than compiled. (if not, it is a compiler error!) Then if they are the same, by using trace. You can trace the two different versions and see where they give different answers. Rarely I insert in the lisp code (break "id") or output statements like (format t "~% location xx with values ~s ~s " x y)
Which all brings to mind the possibility that suggestions like this should be in a FAQ ... How do I debug lisp code in Maxima.
RJF .
Camm Maguire wrote:
Greetings! I have one Debian machine (m68k) which is producing very small numerical discrepancies on the results of the two floating point intensive tests in rtest8.mac:
=============================================================================
/* ********************** Problem 8. *************** */ %Input is
SORT(ALLROOTS(%))
The result is
[X = - 1.015754699707032, X = 0.8296747207641602, X = 1.0,
X = - 0.9659624099731445 %I - 0.4069597721099853,
X = 0.9659624099731445 %I - 0.4069597721099853]
This differed from the expected result:
[X = - 1.015755543828121, X = 0.8296749902129361, X = 1.0,
X = - 0.4069597231924075 - 0.9659625152196368 %I,
X = 0.9659625152196368 %I - 0.4069597231924075]
/* ********************** Problem 24. *************** */ %Input is
SOLVE(%, [X, Y])
The result is
[[X = 2, Y = 2], [X = 0.5202593803405762 %I - 0.1331241130828857,
Y = 0.07678413391113277 - 3.608001708984376 %I],
[X = - 0.5202593803405762 %I - 0.1331241130828857,
Y = 3.608001708984376 %I + 0.07678413391113277],
[X = - 1.733751425313569, Y = - 0.1535679052943111]]
This differed from the expected result:
[[X = 2, Y = 2], [X = 0.5202594388652008 %I - 0.1331240357358706,
Y = 0.07678378523787777 - 3.608003221870287 %I],
[X = - 0.1331240357358706 - 0.5202594388652008 %I,
Y = 0.07678378523787777 + 3.608003221870287 %I],
[X = - 1.733751846381093, Y = - 0.1535675710019696]]
=============================================================================
I notice that these are the two tests which also have commented variable results on different machines in the rtest8.mac file:
============================================================================= sort(ALLROOTS(%)); [X = -1.0157555438281209,X = 0.82967499021293611,X = 1.0, X = -0.96596251521963683*%I-0.40695972319240747, X = 0.96596251521963683*%I-0.40695972319240747]; /* lispm [X = 0.829675,X = -1.0157557,X = 0.9659626*%I-0.4069597, X = -0.9659626*%I-0.4069597,X = 1.0000001]; */ /* result tops20 [X = 0.82967498,X = -1.01575564,X = 0.96596261*%I-0.406959705, X = -0.96596261*%I-0.406959705,X = 1.00000006]$ */ SOLVE(%,[X,Y]); [[X = 2,Y = 2], [X = 0.5202594388652008*%I-0.1331240357358706, Y = 0.07678378523787777-3.608003221870287*%I], [X = -0.5202594388652008*%I-0.1331240357358706, Y = 3.608003221870287*%I+0.07678378523787777], [X = -1.733751846381093,Y = -0.1535675710019696]]; /* lispm [[X = 2,Y = 2],[X = 0.52025807*%I-0.13312346,Y = 0.07678269-3.6080136*%I], [X = -0.52025807*%I-0.13312346,Y = 3.6080136*%I+0.07678269], [X = -1.7337531,Y = -0.1535668]]$ */ /* tops 20 :[[X = 2,Y = 2],[X = 0.52025944*%I-0.133124037,Y = 0.076783786-3.6080032*%I], [X = -0.52025944*%I-0.133124037,Y = 3.6080032*%I+0.076783786], [X = -1.73375185,Y = -0.153567577]]$ */ =============================================================================
Questions:
1) I take it this is still (likely a gcl) error, as all IEEE floating point machines should produce an identical result, no? Should these results vary somewhat in "correct" operation?
2) I'd like to debug this at the lisp level. I've read the info pages on the dbl mode, and can run the example cited. But when I try to :br any function in the maxima source .lisp files, I'm told there is no line info. What's the best way to see where this result is varying in a maxima/lisp debugger?
3) Any m68k cognoscenti care to suggest a likely explanation?
Take care,

