Skip to main content

Crate maryada

Crate maryada 

Source
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§

DecoratedInterval
A binary64 interval paired with an IEEE 1788 decoration.
Interval
A closed binary64 interval, or the distinguished empty interval.
InvalidDecoration
Error returned when a byte or string is not a valid Decoration.
ParseIntervalError
Error returned by core::str::FromStr for an invalid interval literal.
SignalFlags
An accumulating bit set of raised Signal values.

Enums§

Decoration
The definedness and continuity information attached to an interval result.
Signal
An IEEE 1788 exception condition reported by an interval operation.
TextError
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§

IntervalDatum
Common sealed representation surface used by all generic operations.
SignalSink
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 x in [-1, 1].
acosh
Encloses inverse hyperbolic cosine over the part of x at least one.
add
Encloses all pairwise sums of values from x and y.
asin
Encloses the inverse sine over the part of x in [-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 x in (-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 x and y.
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 x and y have 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 x and y denote the same set.
exp
Encloses e^x over the input interval.
exp2
Encloses 2^x over the input interval.
exp10
Encloses 10^x over the input interval.
floor
Encloses the floor of every value in x.
fma
Encloses the fused expression x * y + z with 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 x is contained in the topological interior of y.
intersection
Returns the set intersection of x and y.
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 x is the empty interval; NaI is not empty.
is_entire
Returns whether x contains 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 x and y.
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 x and y.
mul
Encloses all pairwise products of values from x and y.
neg
Computes the additive inverse of every value in x.
new
Constructs an interval datum with endpoints inf and sup.
new_dec
Attaches the strongest valid decoration to a bare interval.
pow
Encloses the real-valued power function for bases in x and exponents in y.
pown
Raises every value in x to the integer power p.
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 to 0, and positive values to 1.
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 x is also a member of y.
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.