>>>>> "Raymond" == Raymond Rogers <Rogers> writes:
Raymond> I have "Interval Methods for Circuit Analysis" by L V Kolev. I think it's
Raymond> a good book. Of course it is dealing with circuit tolerances rather than
Raymond> floating point calculation errors.
Raymond> But interval analysis is limited.
Raymond> When you enter an equation for Interval Analysis each calculation is
Raymond> independent; two different 10 ohm resistors have different values. Now in a
Raymond> lot of circuit cases (parameters of linear equations) you can accomplish
Raymond> isolation of part calculations; but consider (my case)
Raymond> int((x+a)/(x+b)),x=[c,d]) , you can't determine the answer by straight
Raymond> forward interval analysis since the maximum could be at an intermediate
Raymond> value of v (say x=-b), and "interval analysis" is really endpoint analysis.
(defun foo (x)
(declare (type (double-float 9.5d0 10.5d0) x))
(/ (+ x 20) (+ x 10)))
With cmucl, if you (compile 'foo) and then (describe 'foo), you
get:
Its result type is:
(DOUBLE-FLOAT 1.4390243902439024d0 1.564102564102564d0)
That is, (x+20)/(x+10) is always between 1.439... and 1.564... if x is
[9.5,10.5]. I think that's right.
Substitute your favorite values for a and b. Or you could even do
(defun foo2 (x a b)
(declare (type (double-float 9.5d0 10.5d0) x)
(type (double-float 19d0 21d0) a)
(type (double-float 9.9d0 10.1d0) b))
(/ (+ x a) (+ x b)))
CMUCL will tell you that the result is always in the interval
[1.383..., 1.6237...]
CMUCL isn't perfect here. Round-off may very well cause the answers
to be incorrect.
I don't quite understand your comment.
Ray