# Intervals in GiNaC

Simon Langley Simon.Langley at uwe.ac.uk
Mon Dec 1 12:32:27 CET 2003

```Carl,

I have an interval class which I use in GiNaC.  It isn't as tidy as I'd
like but it works in the following sense:

* I'm only interested in polynomials so the interval class doesn't have
other functions like sin/exp/etc just field operations and powers.

* It assumes that either rational or s/w floating point arithmetic is
used. There is a problem with h/w floating point in GiNaC because
underflow/overflow errors may not get noted.  That said because of the
way GiNaC works you can mix floating point and rational arithmetic.

* When used in Ginac expressions, interval expressions aren't
simplified.  I.e. you can write

ex z = interval(-1,1) + x + interval(1, 3)*4 +  interval(1.3, 3.1)

but z.simplify() won't add the intervals and z.subs(x == 2.3) won't
reduce the expression to an interval.  I've written a procedure to
evaluate a  Ginac expression in intervals to an interval (again assuming
you only need polynomial expressions).

If you want it let me know.

By the way are you working with Dan Richardson or has interest in