(x: Interval | IntervalResult)
| 49 | * -[a, b] = [-b, -a] |
| 50 | */ |
| 51 | export function negate(x: Interval | IntervalResult): IntervalResult { |
| 52 | const unwrapped = unwrapOrPropagate(x); |
| 53 | if (!Array.isArray(unwrapped)) return unwrapped; |
| 54 | const [xVal] = unwrapped; |
| 55 | return ok({ lo: -xVal.hi, hi: -xVal.lo }); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Internal multiplication helper that returns plain Interval. |
no test coverage detected