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
19 lines (18 loc) • 867 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.complexEquals = complexEquals;
var _number = require("./number.js");
/**
* Test whether two complex values are equal provided a given relTol and absTol.
* Does not use or change the global Complex.EPSILON setting
* @param {Complex} x - The first complex number for comparison.
* @param {Complex} y - The second complex number for comparison.
* @param {number} relTol - The relative tolerance for comparison.
* @param {number} absTol - The absolute tolerance for comparison.
* @returns {boolean} - Returns true if the two complex numbers are equal within the given tolerances, otherwise returns false.
*/
function complexEquals(x, y, relTol, absTol) {
return (0, _number.nearlyEqual)(x.re, y.re, relTol, absTol) && (0, _number.nearlyEqual)(x.im, y.im, relTol, absTol);
}
;