Menu

#2368 floating point discrepancies, Maxima 5.26.0 + SBCL + MacOS X

open
nobody
5
2012-03-27
2012-03-09
No

I installed the Maxima 5.26.0 binary on Mac OS X 10.7.3. Entering "run_testsuite()" results in the following errors. I am just a casual user and don't know if this is of importance, but you should know. Enclosed the part of the log where the errors occurred:

Running tests in rtest16:
********************** Problem 391 ***************
Input:
closeto(zeta(%i + 3) - (1.10721440843141 - .1482908671781754 %i), 1.e-15)

Result:
3.3157171554456794e-9

This differed from the expected result:
true

********************** Problem 392 ***************
Input:
! 1 !
closeto(!zeta(0.5 %i + -)! - 1.06534921249378, 1.e-14)
! 2 !

Result:
3.119438529708418e-8

This differed from the expected result:
true

********************** Problem 394 ***************
Input:
200! + 1
closeto(float(log(--------)) - 861.2860770433501, 1.e-15)
7

Result:
#.SB-EXT:DOUBLE-FLOAT-POSITIVE-INFINITY

This differed from the expected result:
true

********************** Problem 396 ***************
Input:
200! + 1
closeto(float(log(--------)) - (861.2860770433501 + 3.141592653589793 %i),
- 7
1.e-14)

Result:
#.SB-EXT:DOUBLE-FLOAT-POSITIVE-INFINITY

This differed from the expected result:
true

; in: PROGN (DEFPROP $F T TRANSLATED)
; (SETQ MAXIMA::$X 2)
;
; caught WARNING:
; undefined variable: $X
;
; compilation unit finished
; Undefined variable:
; $X
; caught 1 WARNING condition

; file: /Applications/Maxima.app/Contents/Resources/maxima/share/maxima/5.26.0/share/lbfgs/lb1.lisp
; in: DEFUN LB1
; (PROG ((I 0))
; (DECLARE (TYPE (INTEGER) I))
; (COND
; ((= ITER 0)
; (F2CL-LIB:FFORMAT MP
; ("*************************************************"
; "~%"))
; (F2CL-LIB:FFORMAT MP
; (" N=" 1 # " NUMBER OF CORRECTIONS=" 1 # "~%"
; " INITIAL VALUES" "~%")
; N M)
; (F2CL-LIB:FFORMAT MP (" F= " 1 # " GNORM= " 1 # "~%") F GNORM)
; (COND (# # # # #))
; (F2CL-LIB:FFORMAT MP
; ("*************************************************"
; "~%"))
; (F2CL-LIB:FFORMAT MP
; ("~%" " I NFN" "~5@T" "FUNC" "~20@T" "GNORM" "~19@T"
; "STEPLENGTH" "~%" "~%")))
; (T
; (IF (AND # #)
; (GO END_LABEL))
; (COND (# #) (T # #)) (COND (# # # #))
; (IF FINISH
; (F2CL-LIB:FFORMAT MP #))))
; (GO END_LABEL)
; END_LABEL
; (RETURN (VALUES NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)))
; --> BLOCK
; ==>
; (LET ((I 0))
; (DECLARE (TYPE (INTEGER) I))
; (TAGBODY
; (COND
; ((= ITER 0) (F2CL-LIB:FFORMAT MP #) (F2CL-LIB:FFORMAT MP # N M)
; (F2CL-LIB:FFORMAT MP # F GNORM) (COND #) (F2CL-LIB:FFORMAT MP #)
; (F2CL-LIB:FFORMAT MP #))
; (T
; (IF #
; #)
; (COND # #) (COND #)
; (IF FINISH
; #)))
; (GO END_LABEL)
; END_LABEL
; (RETURN (VALUES NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL))))
;
; caught STYLE-WARNING:
; The variable I is defined but never used.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition

599/603 tests passed

The following 4 problems failed: (391 392 394 396)

[...]

Running tests in rtest_gamma:
********************** Problem 381 ***************
Input:
relerror(gamma_incomplete(0.5, - 5 %i),
0.364419841063559 - .2436855906381129 %i, 3.e-15)

Result:
3.044941054363213e-15

This differed from the expected result:
true

********************** Problem 391 ***************
Input:
relerror(gamma_incomplete(0.5, 5 %i), .2436855906381129 %i
+ 0.364419841063559, 3.e-15)

Result:
3.044941054363213e-15

This differed from the expected result:
true

701/703 tests passed (not counting 2 expected errors)

The following 2 problems failed: (381 391)

[...]

Error summary:
Errors found in /Applications/Maxima.app/Contents/Resources/maxima/share/maxima/5.26.0/tests/rtest16.mac, problems:
(391 392 394 396)
Errors found in /Applications/Maxima.app/Contents/Resources/maxima/share/maxima/5.26.0/tests/rtest_gamma.mac, problems:
(381 391)
6 tests failed out of 9,121 total tests.
Evaluation took:
234.937 seconds of real time
224.627371 seconds of total run time (216.187361 user, 8.440010 system)
[ Run times consist of 24.219 seconds GC time, and 200.409 seconds non-GC time. ]
95.61% CPU
15,983 forms interpreted
9,605 lambdas converted
514,902,811,973 processor cycles
8,813 page faults
23,070,397,776 bytes consed

Discussion

  • Raymond Toy

    Raymond Toy - 2012-03-10

    rtest16 problems 391 and 392 are known issues with sbcl. I've talked to sbcl developers about this and they said they would fix it.

    Problems 394 and 396 also look like problems with sbcl. I suspect that sbcl's cl:log on a very large integer returns infinity when it doesn't have to.

    Problems 381 and 391 could be bugs in sbcl's math routines, but since the actual error is just slightly above the threshold of 3e-15, perhaps this could be remedied by increasing the threshold slightly.

     
  • Robert Dodier

    Robert Dodier - 2012-03-27
    • summary: 5.26.0 run_testsuite fails on Mac OS X --> floating point discrepancies, Maxima 5.26.0 + SBCL + MacOS X
    • labels: --> Lisp Core - Floating point
     
  • Robert Dodier

    Robert Dodier - 2012-03-27

    I've adjusted the title to more narrowly indicate the topic.

    I know that a common work-around for floating point differences is to increase the tolerance when comparing results. I wonder what the "right" answer is. Maybe there is really nothing better to do -- given that Common Lisp doesn't specify accuracy of floating point functions, it appears there is no way within Common Lisp to specify results which depend on any functions other than simple arithmetic.

    Be that as it may, it would be interesting to know where the differences originate. We could construct a test suite for the floating point functions in Common Lisp to see which ones differ and by how much.

     
  • Raymond Toy

    Raymond Toy - 2012-03-27

    Ah, the float(log) tests appear to be an issue with sbcl not signaling an overflow when computing (cl:log <big rational number>). Maxima's implementation expects an overflow error here and then tries its own method to compute it.

    I guess we could have the code check for infinity as well as an error. Not sure why sbcl doesn't signal an error here.

     
  • Raymond Toy

    Raymond Toy - 2012-03-27

    Yes, we really should investigate why the tolerance needs to be changed especially since I think this has been tested with sbcl for a long time.

    But figuring this out is quite tedious and the change in the tolerance is small, so I'm not motivated to investigate.

    For the record, gamma_incomplete(0.5, 5*%i) uses the continued fraction so all lisps ought to produce exactly the same number for the CF part. But there are some exponentials computed and that might be different. But presumably all lisps running on the same platform eventually calls out to the C library to compute exp, so it's not clear what the difference could be.

     

Log in to post a comment.