| 234 | return p >= MIN_NORMAL_DOUBLE && p < Infinity; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * `a / b` for `complex.js` values, a drop-in replacement for `a.div(b)` |
| 239 | * that does not overflow or underflow when the quotient is in the range of a |
| 240 | * double. An ordinary quotient is `a.div(z)` itself, and only an out-of-range |
| 241 | * one pays for the scaling (see `scaledComplexDivide()`). |
| 242 | * |
| 243 | * A zero, infinite or NaN operand, and a real divisor (whose quotient |
| 244 | * `a.div()` computes part by part, without an intermediate value), are left |
| 245 | * to `a.div(b)`, so their results do not change: `x / 0` is the unsigned |
| 246 | * infinity `Complex.INFINITY`, `0 / 0` is `NaN`, `x / ∞` is `0`. |
| 247 | */ |
| 248 | export function complexDivide(a: Complex, b: Complex | number): Complex { |
| 249 | const z = typeof b === 'number' ? new Complex(b, 0) : b; |
| 250 | if ( |
| 251 | z.im === 0 || |