( e: Expression, x: string, ce: ComputeEngine )
| 754 | const n = leadingOrder(num, x, ce, depth).simplify(); |
| 755 | const d = leadingOrder(den, x, ce, depth).simplify(); |
| 756 | |
| 757 | // Compare growth *first*. (Simplifying the quotient first can re-expand it |
| 758 | // back into the original product and loop — e.g. x/(1/ln(1+a/x)).) |
| 759 | const cmp = compareGrowth(n, d, x, ce); |
| 760 | if (cmp !== undefined) { |
| 761 | if (cmp < 0) return ce.Zero; // numerator grows slower → 0 |
| 762 | if (cmp > 0) { |
| 763 | // The sign of each term is read from a numeric probe. A probe with no |
| 764 | // value (a symbolic coefficient, as in `a·eˣ/x`) leaves the sign of |
| 765 | // the infinity undecided: decline. |
| 766 | const sn = numericAt(n, x, 120, ce); |
| 767 | const sd = numericAt(d, x, 120, ce); |
| 768 | if (Number.isNaN(sn) || Number.isNaN(sd) || sn === 0 || sd === 0) |
| 769 | return undefined; |
| 770 | return sn < 0 !== sd < 0 ? ce.NegativeInfinity : ce.PositiveInfinity; |
| 771 | } |
| 772 | // Same growth order → ratio of leading coefficients. |
| 773 | const r = n.div(d).simplify(); |
| 774 | if (!r.has(x)) return r.evaluate(); |
no test coverage detected