( a: Interval | IntervalResult, b: Interval | IntervalResult )
| 961 | * |
| 962 | * Has jump discontinuities at every integer. |
| 963 | */ |
| 964 | function ceilRaw(x: Interval | IntervalResult): IntervalResult { |
| 965 | const unwrapped = unwrapOrPropagate(x); |
| 966 | if (!Array.isArray(unwrapped)) return unwrapped; |
| 967 | const [xVal] = unwrapped; |
| 968 | if (isNaNInterval(xVal)) return ok(NAN_INTERVAL); |
| 969 | const clo = Math.ceil(xVal.lo); |
| 970 | const chi = Math.ceil(xVal.hi); |
| 971 | if (clo === chi) return ok({ lo: clo, hi: chi }); |
| 972 | // Interval spans an integer boundary — a finite jump. ceil is |
| 973 | // left-continuous: lim_{x→n-} ceil(x) = ceil(n) = n. Its values on the |
| 974 | // interval lie in [ceil(lo), ceil(hi)], which is carried as the enclosure. |
| 975 | return jump(clo, 'left', { lo: clo, hi: chi }); |
| 976 | } |
| 977 | |
| 978 | // `isNaNInterval` and `NAN_INTERVAL` are defined near the top of this file: |
| 979 | // the domain-restricted kernels above the step functions use them too. |
| 980 | |
| 981 | /** |
| 982 | * Sound enclosure of a step-rounding function on an interval, given its |
| 983 | * point-rounding rule. If both endpoints round to the same integer the function |
| 984 | * is constant on the interval; otherwise it spans a half-integer jump and the |
| 985 | * result is `singular` carrying the enclosure `[round(lo), round(hi)]` |
| 986 | * (mirrors the Floor/Ceil enclosure discipline). |
no test coverage detected