mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
13 lines (12 loc) • 404 B
JavaScript
import { nearlyEqual } from './number.js';
/**
* Test whether two complex values are equal provided a given epsilon.
* Does not use or change the global Complex.EPSILON setting
* @param {Complex} x
* @param {Complex} y
* @param {number} epsilon
* @returns {boolean}
*/
export function complexEquals(x, y, epsilon) {
return nearlyEqual(x.re, y.re, epsilon) && nearlyEqual(x.im, y.im, epsilon);
}