| 63 | ]; |
| 64 | |
| 65 | function classify(e: any): string { |
| 66 | try { |
| 67 | if (e === undefined || e === null) return 'undef'; |
| 68 | if (e.isNaN) return 'NaN'; |
| 69 | if (e.isInfinity) return 'inf'; |
| 70 | if (e.isNumberLiteral) { |
| 71 | const nv = e.numericValue; |
| 72 | if (typeof nv === 'number') return Number.isInteger(nv) ? 'exact' : 'FLOAT'; |
| 73 | return nv.isExact ? 'exact' : 'FLOAT'; |
| 74 | } |
| 75 | if (e.operator === 'Error') return 'error'; |
| 76 | return 'symbolic'; |
| 77 | } catch (err) { |
| 78 | return 'ERR:' + err; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | function num(e: any): [number, number] { |
| 83 | try { |