simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

complex.js (404B)


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