Check if two input numbers are equal within given tolerance
428585
function isequal(a, b, tolerance) {
    if (tolerance === void 0) { tolerance = constants_1.EPSILON; }
    return iszero(a - b, tolerance);
}
1000318
function checkNum(nums, min, max){
  if(nums == null)
    return false;

  if(nums == -1)
    return true;

  for(let i = 0; i < nums.length; i++){
    if(nums[i]<min || nums[i]>max)
      return false;
  }

  return true;
}
645330
def equals(self, rhs):
    

    try:
      return round(rhs-self._float_value, self._places) == 0
    except TypeError:
      # This is probably because either float_value or rhs is not a number.
      return False
1197886
function checkNumberOrInterpolation(i) {
  const start = i;
  let l;

  while (i < tokensLength) {
    if (l = checkInterpolation(i) || checkNumber(i)) i += l;
    else break;
  }

  return i - start;
}
642199
def within_range(range1, range2):
    """"""
    range1 = [r if isfinite(r) else None for r in range1]
    range2 = [r if isfinite(r) else None for r in range2]
    return ((range1[0] is None or range2[0] is None or range1[0] >= range2[0]) and
            (range1[1] is None or range2[1] is None or range1[1] <= range2[1]))
938006
function sameValueZero(a, b) {
    if (isRealNaN(a)) {
      return isRealNaN(b);
    }
    return a === b ? a !== 0 || 1 / a === 1 / b : false;
  }
516376
def _at_least_x_are_true(a, b, x):
  """"""
  match = tf.equal(a, b)
  match = tf.cast(match, tf.int32)
  return tf.greater_equal(tf.reduce_sum(match), x)
460584
private boolean oneMatchletMagicEquals(int offset, byte[] data) {
        int rangeStart = content.getInt(offset);      // first byte of data for check to start at
        int rangeLength = content.getInt(offset + 4); // last byte of data for check to start at
        int dataLength = content.getInt(offset + 12); // number of bytes in match data/mask
        int dataOffset = content.getInt(offset + 16); // contentBytes offset to the match data
        int maskOffset = content.getInt(offset + 20); // contentBytes offset to the mask

        boolean found = false;

        for (int i = 0; !found && (i <= rangeLength) && (i + rangeStart + dataLength <= data.length); i++) {
            if (maskOffset != 0) {
                found = subArraysEqualWithMask(
                        contentBytes, dataOffset,
                        data, rangeStart + i,
                        contentBytes, maskOffset,
                        dataLength
                );
            } else {
                found = subArraysEqual(
                        contentBytes, dataOffset,
                        data, rangeStart + i,
                        dataLength
                );
            }
        }

        return found;
    }
1348093
def compare (v1, v2):
    """"""
    v1_norm = normalize(v1)
    v2_norm = normalize(v2)
    if v1_norm < v2_norm:
        return -1
    if v1_norm > v2_norm:
        return 1
    return 0
3142
function iszero(x, tolerance) {
    if (tolerance === void 0) { tolerance = constants_1.EPSILON; }
    // the 'less-than-equal' comparision is necessary for correct result
    // when tolerance = 0
    return Math.abs(x) <= tolerance;
}
881404
def valid(a, b):
    """"""
    return ~(np.isnan(a) | np.isinf(a) | np.isnan(b) | np.isinf(b))
983980
def _float_almost_equal(float1, float2, places=7):
    

    if round(abs(float2 - float1), places) == 0:
        return True

    return False
29370
private static int compare(float f1, float f2) {
        if (f1 < f2)
            return -1;           // Neither val is NaN, thisVal is smaller
        if (f1 > f2)
            return 1;            // Neither val is NaN, thisVal is larger

        // Cannot use floatToRawIntBits because of possibility of NaNs.
        int thisBits    = Float.floatToIntBits(f1);
        int anotherBits = Float.floatToIntBits(f2);

        return (thisBits == anotherBits ?  0 : // Values are equal
                (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)
                 1));                          // (0.0, -0.0) or (NaN, !NaN)
    }
539470
def equal(self, a, b, message=None):
        ""
        if a != b:
            self.log_error("{} != {}".format(str(a), str(b)), message)
            return False
        return True
397116
public static boolean notEqualWithinTolerance(double left, double right, double tolerance) {
    if (Doubles.isFinite(left) && Doubles.isFinite(right)) {
      return Math.abs(left - right) > Math.abs(tolerance);
    } else {
      return false;
    }
  }
958656
def _almost_equal(a, b):
    
    # arbitrary small number!!!
    threshold = 1e-9
    diff = np.abs(a - b)
    return (diff < threshold)
219400
def validate_equal(value):
    
    def equal_validator(field, data):
        if field.value is None:
            return
        if not (field.value == value):
            raise ValidationError('equal', other=value)
    return equal_validator