Commit eb3bf5e5 authored by liam's avatar liam

Fix error in test of numerical-integration. For tests with outcome

near zero, just make it zero.


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3293 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent f073ae0e
......@@ -17,12 +17,18 @@
"The number of decimal digits on which floating point
number must agree.")
(defparameter *zero-threshold* 1.0d-15
"Threshold below which a number is tpo be considered zero.")
(defun fp-string (fp &optional (decimal-digits *test-fp-decimal-digits*))
"Format the floating point number as a string for comparison."
(if (typep fp 'complex)
(list (fp-string (realpart fp)) (fp-string (imagpart fp)))
(format nil "~,v,2,0,,,ve"
decimal-digits (if (typep fp 'double-float) #\d #\e) fp)))
decimal-digits (if (typep fp 'double-float) #\d #\e)
(if (< (abs fp) *zero-threshold*)
0.0d0
fp))))
(defmacro assert-first-fp-equal (expected form &rest extras)
(lisp-unit::expand-assert
......
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2008-02-03 13:22:48EST numerical-integration.lisp>
;; Time-stamp: <2008-02-16 11:07:23EST numerical-integration.lisp>
;; $Id: $
;;; To do: QAWS, QAWO, QAWF, more tests
......@@ -232,5 +232,5 @@
(integration-QAG one-sine 0.0d0 pi :gauss15 20 ws)))
(lisp-unit:assert-error
'gsl-error
(letm ((ws (integration-workspace ws 20)))
(letm ((ws (integration-workspace 20)))
(integration-QAG one-sine 0.0d0 pi :gauss15 50 ws))))
;; Polynomials
;; Liam Healy, Tue Mar 21 2006 - 18:33
;; Time-stamp: <2008-02-05 22:35:20EST polynomial.lisp>
;; Time-stamp: <2008-02-16 11:17:51EST polynomial.lisp>
;; $Id: $
(in-package :gsl)
......@@ -194,8 +194,8 @@
(lisp-unit:fp-values (solve-cubic -6.0d0 -13.0d0 42.0d0)))
;; This should use double-float-unequal
(lisp-unit:assert-equal
'(("-0.902598308594d-17" "-1.000000000000d+00")
("-0.902598308594d-17" "1.000000000000d+00")
'(("0.000000000000d+01" "-1.000000000000d+00")
("0.000000000000d+01" "1.000000000000d+00")
("0.100000000000d+01" "0.000000000000d+01"))
(lisp-unit:fp-values (solve-cubic-complex -1.0d0 1.0d0 -1.0d0)))
(lisp-unit:assert-equal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment