jitx/interval¶
Package name: jitx/interval
Interval Type
The Interval type is a mechanism for defining inclusive ranges of values. The
Interval doesn't have a typical value like Toleranced but does allow
infinite intervals which Toleranced does not allow.
An example of an Interval might be the operating temperature range for a design.
The typical is not generally specified in datasheets because it is application
specific.
References¶
- https://en.wikipedia.org/wiki/Interval_arithmetic
Summary¶
Interval¶
Interval Type for defining ranges over the Double
Multis¶
| Function | Description |
|---|---|
| min-value? | Minimum Value of the range. |
| max-value? | Maximum Value of the range |
Definitions¶
Interval¶
Interval Type for defining ranges over the Double
public deftype Interval <: Equalable & Hashable
This type provides a mechanism to support limited and unlimited ranges. Possible configurations are:
- Restricted Ranges:
- Defined
minandmax- restricts the interval to a range.minis expected to be less thanmax- This range is inclusive of the end points.
- Defined
- Unrestricted Ranges:
- Defined
minbut nomax- This is theAtLeastform.- This form is inclusive of the
minvalue.
- This form is inclusive of the
- Defined
maxbut nomin- This is theAtMostform.- This form is inclusive of the
maxvalue.
- This form is inclusive of the
- Neither
minnormax- This is theAnyNumberform.- This is effectively an infinite interval.
- Defined
There is no "typical" value for an interval. See Toleranced for a treatment with a "typical" value.
Multis¶
min-value?¶
Minimum Value of the range.
public defmulti min-value? (ivl:Interval) -> Double|False
- Returns
Double|False
If this value is false then the range is unbounded on the low end.
All implementations of Interval are expected to implement this interface.
max-value?¶
Maximum Value of the range
public defmulti max-value? (ivl:Interval) -> Double|False
- Returns
Double|False
If this value is false then the range is unbounded on the high end.
All implementations of Interval are expected to implement this interface.
Functions¶
AnyNumber¶
Unbounded Interval
public defn AnyNumber () -> Interval
- Returns
Interval
This is a helper function for creating an unbounded interval on both ends, i.e. an interval which contains every real number.
Interval¶
Constructor for an Interval type.
public defn Interval (lo:Double|False, hi:Double|False) -> Interval
lo: Double|False- Inclusive min value if notfalse. Otherwise sets the minimum to unbounded.hi: Double|False- Inclusive max value if notfalse. Otherwise sets the maximum to unbounded.- Returns
Interval - Throws
RuntimeError- If thelovalue is greater than thehivalue.
AtLeast¶
Interval with unbounded maximum and bounded minimum
public defn AtLeast (x:Double) -> Interval
x: Double- Inclusive low end bound for the interval- Returns
Interval
This is a helper function for creating a interval that is bounded from below only.
AtMost¶
Interval with unbounded minimum and bounded maximum
public defn AtMost (x:Double) -> Interval
x: Double- Inclusive high end bound for the interval- Returns
Interval
This is a helper function for creating a interval that is bounded from above only.
Related Packages¶
Forwarded by package: jitx