Expand description
A no_std binary64 real interval arithmetic library conforming to IEEE 1788.1.
The rectangular complex interval extension is outside the scope of the standard.
maryada provides Interval and DecoratedInterval for outward-rounded
real interval arithmetic, ComplexBox for rectangular complex intervals
when the complex feature is enabled, and text and binary interchange operations. Most arithmetic functions are
generic over IntervalDatum, so the same free-function API works with
bare and decorated intervals.
The inherent methods offer the same operations in a chaining-friendly form:
use maryada::Interval;
let x = Interval::new(1.0, 2.0);
let y = x.sqr();
assert_eq!(y.bounds(), (1.0, 4.0));Operations return enclosing intervals. Decorated operations additionally
propagate the weakest input or operation decoration. APIs that report IEEE
exception conditions accept a SignalSink; pass &mut () to ignore them.
Modules§
- prelude
- Common interval types for glob imports.
Structs§
- Decorated
Interval - A binary64 interval paired with an IEEE 1788 decoration.
- Interval
- A closed binary64 interval, or the distinguished empty interval.
- Invalid
Decoration - Error returned when a byte or string is not a valid
Decoration. - Parse
Interval Error - Error returned by
core::str::FromStrfor an invalid interval literal. - Signal
Flags - An accumulating bit set of raised
Signalvalues.
Enums§
- Decoration
- The definedness and continuity information attached to an interval result.
- Signal
- An IEEE 1788 exception condition reported by an interval operation.
- Text
Error - Error returned when formatting an interval into a caller-provided buffer.
Constants§
- DECORATED_
INTERVAL_ ENCODED_ LEN - Encoded length of a decorated interval: two endpoints and one decoration.
- INTERVAL_
ENCODED_ LEN - Encoded length of a bare interval: two binary64 endpoints.
Traits§
- Interval
Datum - Common sealed representation surface used by all generic operations.
- Signal
Sink - Receives exception conditions raised by interval operations.
Functions§
- abs
- Encloses the absolute value of every value in
x. - acos
- Encloses the inverse cosine over the part of
xin[-1, 1]. - acosh
- Encloses inverse hyperbolic cosine over the part of
xat least one. - add
- Encloses all pairwise sums of values from
xandy. - asin
- Encloses the inverse sine over the part of
xin[-1, 1]. - asinh
- Encloses the inverse hyperbolic sine of every value in
x. - atan
- Encloses the inverse tangent of every value in
x. - atan2
- Encloses the two-argument angle
atan2(y, x). - atanh
- Encloses inverse hyperbolic tangent over the part of
xin(-1, 1). - cancel_
minus - Computes the cancellative subtraction operation
x ⊖ y. - cancel_
plus - Computes the cancellative addition operation
x ⊕ y. - ceil
- Encloses the ceiling of every value in
x. - convex_
hull - Returns the smallest interval containing both
xandy. - cos
- Encloses the cosine of every value in
x. - cosh
- Encloses the hyperbolic cosine of every value in
x. - decorated_
interval_ from_ be_ bytes - Decodes a big-endian decorated interval.
- decorated_
interval_ from_ le_ bytes - Decodes a little-endian decorated interval.
- decorated_
interval_ to_ be_ bytes - Encodes a decorated interval using big-endian endpoint bytes.
- decorated_
interval_ to_ le_ bytes - Encodes a decorated interval using little-endian endpoint bytes.
- decoration_
part - Returns the decoration component of a decorated interval.
- disjoint
- Returns whether
xandyhave no common members. - div
- Encloses all defined quotients
x / y. - empty
- Returns the empty interval.
- entire
- Returns the interval containing every real number.
- equal
- Returns whether
xandydenote the same set. - exp
- Encloses
e^xover the input interval. - exp2
- Encloses
2^xover the input interval. - exp10
- Encloses
10^xover the input interval. - floor
- Encloses the floor of every value in
x. - fma
- Encloses the fused expression
x * y + zwith one final rounding step. - hypot
- Encloses
sqrt(x² + y²)for values drawn from both intervals. - inf
- Returns the lower endpoint, or NaN for NaI.
- interior
- Returns whether
xis contained in the topological interior ofy. - intersection
- Returns the set intersection of
xandy. - interval_
from_ be_ bytes - Decodes a big-endian bare interval.
- interval_
from_ le_ bytes - Decodes a little-endian bare interval.
- interval_
part - Extracts the bare interval, signaling and returning empty for NaI.
- interval_
to_ be_ bytes - Encodes a bare interval using big-endian IEEE 754 endpoint bytes.
- interval_
to_ le_ bytes - Encodes a bare interval using little-endian IEEE 754 endpoint bytes.
- interval_
to_ text - IEEE intervalToText.
- is_
empty - Returns whether
xis the empty interval; NaI is not empty. - is_
entire - Returns whether
xcontains every real number. - is_nai
- Returns whether a decorated interval is Not an Interval.
- log
- Encloses the natural logarithm over the positive part of
x. - log2
- Encloses the base-two logarithm over the positive part of
x. - log10
- Encloses the base-ten logarithm over the positive part of
x. - mag
- Returns the magnitude, the greatest absolute value in
x. - max
- Encloses the pointwise maximum of values from
xandy. - mid
- Returns a representative midpoint, or NaN for an empty interval or NaI.
- mid_rad
- Returns a midpoint and an upward-rounded radius enclosing
x. - mig
- Returns the mignitude, the least absolute value in
x. - min
- Encloses the pointwise minimum of values from
xandy. - mul
- Encloses all pairwise products of values from
xandy. - neg
- Computes the additive inverse of every value in
x. - new
- Constructs an interval datum with endpoints
infandsup. - new_dec
- Attaches the strongest valid decoration to a bare interval.
- pow
- Encloses the real-valued power function for bases in
xand exponents iny. - pown
- Raises every value in
xto the integer powerp. - rad
- Returns the radius rounded upward.
- recip
- Encloses the reciprocals of the nonzero values in
x. - round_
ties_ to_ away - Encloses rounding to nearest integer with ties away from zero.
- round_
ties_ to_ even - Encloses rounding to nearest integer with ties to even.
- set_dec
- Attaches
decoration, weakening it when required by the interval. - sign
- Maps negative values to
-1, zero to0, and positive values to1. - sin
- Encloses the sine of every value in
x. - singleton
- Constructs the singleton interval containing
value. - sinh
- Encloses the hyperbolic sine of every value in
x. - sqr
- Encloses the squares of all values in
x. - sqrt
- Encloses the real square roots of the nonnegative part of
x. - sub
- Encloses all pairwise differences
x - y. - subset
- Returns whether every member of
xis also a member ofy. - sup
- Returns the upper endpoint, or NaN for NaI.
- tan
- Encloses the defined tangent values over
x. - tanh
- Encloses the hyperbolic tangent of every value in
x. - trunc
- Encloses truncation toward zero for every value in
x. - wid
- Returns the interval width rounded upward.
- zero
- Returns the singleton interval containing zero.