On this page:
Rival:   Real Computation via Interval Arithmetic
8.13.0.7

Rival: Real Computation via Interval Arithmetic🔗ℹ

Pavel Panchekha

 (require rival) package: rival

Rival is an advanced interval arithmetic library for arbitrary-precision computation of complex mathematical expressions. Its interval arithmetic is valid and attempts to be tight. Besides the standard intervals, Rival also supports boolean intervals, error intervals, and movability flags, as described in "An Interval Arithmetic for Robust Error Estimation".

Rival is a part of the Herbie project, and is developed on Github.

Rival can be to evaluate real-number expressions:

> (define expr '(- (sin x) (- x (/ (pow x 3) 6))))
> (define machine (rival-compile (list expr) '(x) (list flonum-discretization)))
> (rival-apply machine (vector (bf 0.5)))

'#(0.0002588719375363336)

> (rival-apply machine (vector (bf 0.25)))

'#(8.125921189596264e-6)

It can also be used as an interval-arithmetic library:

> (bf-precision 20)
> (define x (ival 2.bf 3.bf))
> x

(ival (bf 2) (bf 3))

> (ival-add x x)

(ival (bf 4) (bf 6))

> (ival-sqrt x)

(ival (bf #e1.4142132) (bf #e1.7320518))

Rival is fast, accurate, and sound. We believe it to be a state-of-the-art implementation, competitive with Sollya/MPFI, Calcium/Arb, and Mathematica.