* Apply the 'Power' form recursively. Each sub-expression is visited * and any `Power` at the current level is canonicalized via `canonicalPower`. * * Note: `divideForm` intentionally calls `powerForm` on its operands before * passing them to `canonicalDivide`, since division canonicalization be
(expr: Expression)
| 303 | } |
| 304 | if (ops.length === 2) { |
| 305 | const re = ops[0].re; |
| 306 | const im = ops[1].re; |
| 307 | if (im !== null && re !== null && !isNaN(im) && !isNaN(re)) { |
| 308 | if (im === 0 && re === 0) return ce.Zero; |
| 309 | if (im !== 0) return ce.number(ce._numericValue({ re, im })); |
| 310 | return ops[0]; |
| 311 | } |
| 312 | return ce._fn( |
| 313 | 'Add', |
| 314 | [ops[0], ce._fn('Multiply', [ops[1], ce.I], { canonical: false })], |
| 315 | { canonical: false } |
| 316 | ); |
| 317 | } |
no test coverage detected