[ Marquette | MSCS | Corliss | Vladik's Intervals ]
Interval FAQ: [ Entry page | Contents | Search ]
About Sun's f95 with Interval Support

# Interval FAQ Bjørn Tjøstheim -- Can I replace real arithmetic with intervals?

From Bjørn Peter Tjøstheim (bjornpt@ii.uib.no):

## Can I replace real arithmetic with intervals?

I have coded a rather large Fortran 90 program which in the end computes bounds for a norm. To ensure that these bounds are not affected by roundoff error, I want to use interval arithmetic.

Will it work to replace double precision by type (interval) throughout the program? Does there exist BLAS, LAPACK routines with the type(interval)? Or is this the wrong line of attack all together ...

Bjørn Peter Tjøstheim

See related FAQ: How do I convert a real/double code to intervals?

### Response by R. Baker Kearfott:

(rbk@usl.edu), University of Southwestern Louisiana:
1. There are various packages that provide type(interval). In particular, I have a Fortran 90 module that provides it. It is ACM Transactions on Mathematical Software Algorithm 763. I also have an enhanced, but possibly less portable version of this module in the GlobSol software. See my home page at http://interval.louisiana.edu/kearfott.html
2. Whether replacing all "double precision" by "interval" is appropriate depends on the problem specifics. In general, however, I recommend against converting an entire applications program to interval. Interval arithmetic can usually be used effectively, but only wisely, in appropriate places. If it isn't too much trouble, you can try converting your program into interval. If you do get reasonable bounds, then that proves that roundoff error is not a factor. However, if you get wide bounds, it proves nothing. With additional thought, with many problems you can minimize the chance that wide bounds are produced. With some problems, you can even set up a convergent iteration that proves that roundoff is not a problem.

I hope this helps.

R. Baker Kearfott, http://interval.louisiana.edu/kearfott.html

### Response by George Corliss:

(georgec@mscs.mu.edu), Department of Mathematics, Statistics, and Computer Science, Marquette University.

I think Baker and I are both saying,

1. You can do that, but it is not trivial
2. If you do, you MAY get what you want, but you may not.
3. You really should start all over.
In spite of that rather pessimistic advice, it does not hurt to try. With Baker's Fortran 90 module, it is fairly easy to convert. If you have data-dependent IF statements, it is harder because you should consider carefully what the interval analog is. Alternatively, if you suspect that few of the IF statements are ambiguous as interval tests, you can just program a guard in front of each IF that tells you if the test is ambiguous, and then fix the troublesome ones, leaving the unambiguous ones alone.

As Baker suggests, if you get narrow intervals, you know you are safe. If you get relatively wide intervals, you can decide how hard to work.

Let us know how it goes.

George Corliss (georgec@mscs.mu.edu)

[ Marquette | MSCS | Corliss | Vladik's Intervals ]
Interval FAQ: [ Entry page | Contents | Search ]
About Sun's f95 with Interval Support

If you have a question related to validated computing, interval analysis, or related matters, I recommend