tur/float-range
FloatRange: continuous interval with inclusive or exclusive ends.
Since: Phase RR4
float-range-bound-new
(float-range-bound-new [inclusive :int value :float] :int)
allocate a FloatRangeBound with given inclusivity and value.
| inclusive | 1 for inclusive, 0 for exclusive | |
| value | the endpoint value (float64) |
int64_t pointer to a heap FloatRangeBound.
Since: RR4
float-range-bound-inclusive?
(float-range-bound-inclusive? [b :int] :bool)
true if the bound is inclusive.
| b | int64_t pointer to a FloatRangeBound (must not be 0) |
Since: RR4
float-range-bound-value
(float-range-bound-value [b :int] :float)
return the endpoint value of a bound.
| b | int64_t pointer to a FloatRangeBound (must not be 0) |
Since: RR4
float-range-new
(float-range-new [lower :int upper :int] :int)
allocate a FloatRange from lower and upper bound pointers.
| lower | 0 for unbounded below, else FloatRangeBound pointer | |
| upper | 0 for unbounded above, else FloatRangeBound pointer |
int64_t pointer to a heap FloatRange.
Since: RR4
float-range-lower
(float-range-lower [r :int] :int)
return the lower bound pointer (0 = unbounded).
| r | int64_t pointer to a FloatRange |
Since: RR4
float-range-upper
(float-range-upper [r :int] :int)
return the upper bound pointer (0 = unbounded).
| r | int64_t pointer to a FloatRange |
Since: RR4
float-range-val-in-lower?
(float-range-val-in-lower? [lower :int v :float] :bool)
check value against a lower bound.
float-range-val-in-upper?
(float-range-val-in-upper? [upper :int v :float] :bool)
check value against an upper bound.
float-closed-range
(float-closed-range [lo :float hi :float] :int)
[lo, hi] both endpoints inclusive.
| lo | lower bound value | |
| hi | upper bound value |
A FloatRange representing [lo, hi].
(float-closed-range 0.0 1.0) ; => [0.0, 1.0]
Since: RR4
float-open-range
(float-open-range [lo :float hi :float] :int)
(lo, hi) both endpoints exclusive.
| lo | lower bound value (excluded) | |
| hi | upper bound value (excluded) |
A FloatRange representing (lo, hi).
(float-open-range 0.0 1.0) ; => (0.0, 1.0)
Since: RR4
float-closed-open-range
(float-closed-open-range [lo :float hi :float] :int)
[lo, hi) inclusive lower, exclusive upper.
| lo | lower bound value (included) | |
| hi | upper bound value (excluded) |
A FloatRange representing [lo, hi).
(float-closed-open-range 0.0 1.0) ; => [0.0, 1.0)
Since: RR4
float-open-closed-range
(float-open-closed-range [lo :float hi :float] :int)
(lo, hi] exclusive lower, inclusive upper.
| lo | lower bound value (excluded) | |
| hi | upper bound value (included) |
A FloatRange representing (lo, hi].
(float-open-closed-range 0.0 1.0) ; => (0.0, 1.0]
Since: RR4
float-at-least-range
(float-at-least-range [lo :float] :int)
[lo, +inf) inclusive lower, unbounded above.
| lo | lower bound value (included) |
A FloatRange representing [lo, +inf).
(float-at-least-range 0.0) ; => [0.0, +inf)
Since: RR4
float-greater-than-range
(float-greater-than-range [lo :float] :int)
(lo, +inf) exclusive lower, unbounded above.
| lo | lower bound value (excluded) |
A FloatRange representing (lo, +inf).
(float-greater-than-range 0.0) ; => (0.0, +inf)
Since: RR4
float-at-most-range
(float-at-most-range [hi :float] :int)
(-inf, hi] unbounded below, inclusive upper.
| hi | upper bound value (included) |
A FloatRange representing (-inf, hi].
(float-at-most-range 1.0) ; => (-inf, 1.0]
Since: RR4
float-less-than-range
(float-less-than-range [hi :float] :int)
(-inf, hi) unbounded below, exclusive upper.
| hi | upper bound value (excluded) |
A FloatRange representing (-inf, hi).
(float-less-than-range 1.0) ; => (-inf, 1.0)
Since: RR4
float-singleton-range
(float-singleton-range [v :float] :int)
[v, v] a range containing exactly one value.
| v | the single value |
A FloatRange representing [v, v].
(float-singleton-range 0.5) ; => [0.5, 0.5]
Since: RR4
float-unbounded-range
(float-unbounded-range :int)
(-inf, +inf) no bounds at all.
A FloatRange representing all float values.
(float-unbounded-range) ; => (-inf, +inf)
Since: RR4
float-range-contains?
(float-range-contains? [r :int v :float] :bool)
true if value v falls within float range r.
| r | int64_t pointer to a FloatRange | |
| v | float value to test |
true if v satisfies both the lower and upper bounds of r.
(float-range-contains? (float-closed-range 0.0 1.0) 0.5) ; => true (float-range-contains? (float-open-range 0.0 1.0) 0.0) ; => false
Since: RR4