| 356 | } |
| 357 | |
| 358 | asymmetricMatch(other: number) { |
| 359 | if (!isA('Number', other)) { |
| 360 | return false |
| 361 | } |
| 362 | |
| 363 | let result = false |
| 364 | if ( |
| 365 | other === Number.POSITIVE_INFINITY |
| 366 | && this.sample === Number.POSITIVE_INFINITY |
| 367 | ) { |
| 368 | result = true // Infinity - Infinity is NaN |
| 369 | } |
| 370 | else if ( |
| 371 | other === Number.NEGATIVE_INFINITY |
| 372 | && this.sample === Number.NEGATIVE_INFINITY |
| 373 | ) { |
| 374 | result = true // -Infinity - -Infinity is NaN |
| 375 | } |
| 376 | else { |
| 377 | result = Math.abs(this.sample - other) < 10 ** -this.precision / 2 |
| 378 | } |
| 379 | return this.inverse ? !result : result |
| 380 | } |
| 381 | |
| 382 | toString() { |
| 383 | return `Number${this.inverse ? 'Not' : ''}CloseTo` |