| 1210 | cmp: (a: number, b: number) => boolean |
| 1211 | ): boolean { |
| 1212 | const u = build(args[0], ctx).evaluate(); |
| 1213 | if (!isLiteralInteger(u)) return false; |
| 1214 | const a = realNum(u); |
| 1215 | const b = realNum(build(args[1], ctx)); |
| 1216 | return a !== null && b !== null && cmp(a, b); |
| 1217 | } |
| 1218 | |
| 1219 | // Rubi PosAux (sign heuristic): numbers by value; symbols positive; |
| 1220 | // products multiply signs; sums take the first term; even powers positive. |
| 1221 | function posAux(u: Expression): boolean { |
| 1222 | const r = realNum(u); |
| 1223 | if (r !== null) return r > 0; |
| 1224 | const n = u.N(); |
| 1225 | if (isNumber(n) && typeof n.re === 'number' && typeof n.im === 'number') { |
| 1226 | return n.re !== 0 ? n.re > 0 : n.im > 0; |