UNPKG

401 BJavaScriptView Raw
1import { nearlyEqual } from './number'
2
3/**
4 * Test whether two complex values are equal provided a given epsilon.
5 * Does not use or change the global Complex.EPSILON setting
6 * @param {Complex} x
7 * @param {Complex} y
8 * @param {number} epsilon
9 * @returns {boolean}
10 */
11export function complexEquals (x, y, epsilon) {
12 return nearlyEqual(x.re, y.re, epsilon) && nearlyEqual(x.im, y.im, epsilon)
13}