(x: Interval | IntervalResult)
| 123 | * compiled JavaScript apply (`isMachineTrigPole`, `numerics/numeric.ts`): |
| 124 | * `lo` and `hi` are the values at `x.lo` and `x.hi`, and the pole is at |
| 125 | * `extremum + n·period`. `undefined` when neither endpoint is a pole. The |
| 126 | * location is the pole nearest the endpoint that is a pole, clamped into the |
| 127 | * interval: consumers subdivide along it, and the pole itself may lie just |
| 128 | * outside the interval, within the endpoint's rounding error. |
| 129 | * |
| 130 | * The pole search of the kernels finds a pole that lies inside the interval, |
| 131 | * which for a point interval is only the double nearest the pole. A point |
| 132 | * at `π/2 + 10⁻¹⁵` answered a finite enclosure near `−9.5·10¹⁴` where the |
| 133 | * interpreter answers `~oo`, and a plot drew a wild segment there. The |
| 134 | * enclosure of a real point `x` is finite, but a double argument stands for |
| 135 | * a rounded real, and the three routes must answer the same pole at the same |
| 136 | * argument. |
| 137 | */ |
| 138 | function machinePole( |
| 139 | x: Interval, |
| 140 | lo: number, |
| 141 | hi: number, |
| 142 | extremum: number, |
| 143 | period: number |
| 144 | ): IntervalResult | undefined { |
| 145 | const atLo = isMachineTrigPole(lo, x.lo); |
| 146 | if (!atLo && !isMachineTrigPole(hi, x.hi)) return undefined; |
| 147 | const endpoint = atLo ? x.lo : x.hi; |
| 148 | const n = Math.round((endpoint - extremum) / period); |
| 149 | const pole = extremum + n * period; |
no test coverage detected