(a, b, epsilon)
| 69467 | return t * b + (1 - t) * a; |
| 69468 | } |
| 69469 | function equals(a, b, epsilon) { |
| 69470 | const oldEpsilon = config.EPSILON; |
| 69471 | if (epsilon) config.EPSILON = epsilon; |
| 69472 | try { |
| 69473 | if (a === b) return true; |
| 69474 | if (isArray(a) && isArray(b)) { |
| 69475 | if (a.length !== b.length) return false; |
| 69476 | for(let i = 0; i < a.length; ++i){ |
| 69477 | if (!equals(a[i], b[i])) return false; |
| 69478 | } |
| 69479 | return true; |
| 69480 | } |
| 69481 | if (a && a.equals) return a.equals(b); |
| 69482 | if (b && b.equals) return b.equals(a); |
| 69483 | if (typeof a === "number" && typeof b === "number") return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b)); |
| 69484 | return false; |
| 69485 | } finally{ |
| 69486 | config.EPSILON = oldEpsilon; |
| 69487 | } |
| 69488 | } |
| 69489 | function exactEquals(a, b) { |
| 69490 | if (a === b) return true; |
| 69491 | if (a && typeof a === "object" && b && typeof b === "object") { |
no test coverage detected