A comprehensive, correctly rounding interval arithmetic library for Rust

License: Apache-2.0

Language: Rust

Keywords: arbitrary-precision, correct-rounding, interval-arithmetic, mpfr, rust

Honest Intervals

Crate Documentation License Downloads

Honest Intervals is an arbitrary precision interval arithmetic library with correct rounding.

It implements elementary arithmetic (addition, subtraction, multiplication and division) as well as complicated mathematical functions such as logarithm and power over intervals and interval sets. Bounds of the return values are always correctly rounded up or down to ensure that all possible results are contained.

In addition to the Interval and IntervalSet structs, the library also provides the Mpfr struct that wraps the GNU MPFR library. The Mpfr struct is an ideal (and currently only) bound type for intervals.

Honest Intervals tries to be a pragmatic implementation of interval arithmetic rather than an abstract basis for all possible implementations. Users do not have to implement any traits; they can create a correctly rounding interval right away by calling IntervalSet::<Mpfr>::new().

Quick Start

Here is a code that creates two interval sets and adds them.

use honestintervals::IntervalSet;
use honestintervals::mpfr::Mpfr;
use std::str::FromStr;

let x = IntervalSet::<Mpfr>::from_str("{0; <1, 2>}").unwrap();
let y = IntervalSet::<Mpfr>::singleton(Mpfr::from(3.0));
assert_eq!("{3; <4, 5>}", format!("{}", x + y));

Here is a tricky case of interval division handled correctly by Honest Intervals.

let x = IntervalSet::<Mpfr>::from_str("<1, 2>").unwrap();
let y = IntervalSet::<Mpfr>::from_str("<-1, 1>").unwrap();
assert_eq!("{<-inf, -1>; <1, inf>}", format!("{}", x / y));

See the documentation for more details.


Honest Intervals is distributed under the terms of the Apache License (Version 2.0).

See LICENSE for details.

Project Statistics

Sourcerank 3
Repository Size 81.1 KB
Stars 1
Forks 1
Watchers 1
Open issues 0
Dependencies 1
Contributors 1
Tags 0
Last updated
Last pushed

Top Contributors See all

Eser Aygün

Packages Referencing this Repo

Comprehensive, correctly rounding interval arithmetic library.
Latest release 0.2.0 - Updated - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-05-05 00:04:45 UTC

Login to resync this repository