Return a negative value if v1 < v2, zero if v1 = v2, a positive value otherwise.  See https://getcomposer.org/doc/04-schema.md#version and https://github.com/badges/shields/issues/319#issuecomment-74411045
169664
function compare(v1, v2) {
  // Omit the starting `v`.
  const rawv1 = omitv(v1)
  const rawv2 = omitv(v2)
  let v1data, v2data
  try {
    v1data = numberedVersionData(rawv1)
    v2data = numberedVersionData(rawv2)
  } catch (e) {
    return asciiVersionCompare(rawv1, rawv2)
  }

  // Compare the numbered part (eg, 1.0.0 < 2.0.0).
  const numbersCompare = listCompare(v1data.numbers, v2data.numbers)
  if (numbersCompare !== 0) {
    return numbersCompare
  }

  // Compare the modifiers (eg, alpha < beta).
  if (v1data.modifier < v2data.modifier) {
    return -1
  } else if (v1data.modifier > v2data.modifier) {
    return 1
  }

  // Compare the modifier counts (eg, alpha1 < alpha3).
  if (v1data.modifierCount < v2data.modifierCount) {
    return -1
  } else if (v1data.modifierCount > v2data.modifierCount) {
    return 1
  }

  return 0
}
1262983
def numberp(v):
    """"""
    return (not(isinstance(v, bool)) and
            (isinstance(v, int) or isinstance(v, float)))
1203517
public static double[] minusEquals(final double[] v1, final double s1) {
    for(int i = 0; i < v1.length; i++) {
      v1[i] -= s1;
    }
    return v1;
  }
901932
public static double[] minusTimes(final double[] v1, final double[] v2, final double s2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    final double[] sub = new double[v1.length];
    for(int i = 0; i < v1.length; i++) {
      sub[i] = v1[i] - v2[i] * s2;
    }
    return sub;
  }
80294
def sub_v2(v, w):
    

    if type(w) is float or type(w) is int:
        return Vec2(v.x - w, v.y - w)
    else:
        return Vec2(v.x - w.x, v.y - w.y)
479499
def ne(self, value):
        
        self.op = '!='
        self.negate_op = '='
        self.value = self._value(value)
        return self
652403
public static int ifloor (float v) {
        int iv = (int)v;
        return (v >= 0f || iv == v || iv == Integer.MIN_VALUE) ? iv : (iv - 1);
    }
253166
function semanticVersionComparator (v1, v2) {
  const [major1, minor1, patch1] = v1.split('.').map(Number)
  const [major2, minor2, patch2] = v2.split('.').map(Number)
  if (major1 > major2) {
    return 1
  } else if (major1 === major2) {
    if (minor1 > minor2) {
      return 1
    } else if (minor1 === minor2) {
      if (patch1 > patch2) {
        return 1
      } else if (patch1 === patch2) {
        return 0
      } else {
        return -1
      }
    } else {
      return -1
    }
  } else {
    return -1
  }
}
225576
def positive_int(value: str) -> int:
    
    try:
        ivalue = int(value)
        assert ivalue > 0
    except (AssertionError, TypeError, ValueError):
        raise ArgumentTypeError(
            "{!r} is an invalid positive int".format(value))
    return ivalue
1176394
@Pure
	@Inline(value = "MathUtil.isEpsilonEqual($1, $2, Double.NaN)", imported = {MathUtil.class})
	public static boolean isEpsilonEqual(double v1, double v2) {
		return isEpsilonEqual(v1, v2, Double.NaN);
	}
377830
def _pre_compute_secondary(self, positive_vals, negative_vals):
        """"""
        self._secondary_min = (
            negative_vals and min(min(negative_vals), self.zero)
        ) or self.zero
        self._secondary_max = (
            positive_vals and max(max(positive_vals), self.zero)
        ) or self.zero
1372280
def get_version_relationship(ver_str1, ver_str2):
    

    # Expect first type to be a digit, per Gentoo spec (used by apk)
    v1_type = TokenType.DIGIT
    v2_type = TokenType.DIGIT
    v1_tok = 0
    v2_tok = 0

    if ver_str1 is None and ver_str2 is None:
        return ComparisonResult.equal_to

    if ver_str1 is None and ver_str2 is not None:
        return ComparisonResult.less_than

    if ver_str1 is not None and ver_str2 is None:
        return ComparisonResult.greater_than

    # Find either the end of one string or the first invalid token of first non-equal token pair.
    while v1_type == v2_type and v1_type != TokenType.END and v1_type != TokenType.INVALID and v1_tok == v2_tok:
        v1_tok, v1_type, ver_str1 = get_token(v1_type, ver_str1)
        v2_tok, v2_type, ver_str2 = get_token(v2_type, ver_str2)

    # Check the value of the current token
    if v1_tok < v2_tok:
        return ComparisonResult.less_than

    if v1_tok > v2_tok:
        return ComparisonResult.greater_than

    if v1_type == v2_type:
        return ComparisonResult.equal_to

    if v1_type == TokenType.SUFFIX and get_token(v1_type, ver_str1)[0] < 0:
        return ComparisonResult.less_than

    if v2_type == TokenType.SUFFIX and get_token(v2_type, ver_str2)[0] < 0:
        return ComparisonResult.greater_than

    if v1_type > v2_type:
        return ComparisonResult.less_than

    if v2_type > v1_type:
        return ComparisonResult.greater_than

    return ComparisonResult.equal_to
661990
private static BigDecimal doSubtract(final BigDecimal v1, final BigDecimal v2) {
        BigDecimal diff = v1;
        if (v1 != null && v2 != null) {
            diff = v1.subtract(v2);
        } else if (v2 != null) {
            diff = v2.negate();
        }
        return diff;
    }
160651
private int trMedian3(int ISAd, int v1, int v2, int v3) {
        if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v2]]) {
            int t = v1;
            v1 = v2;
            v2 = t;
        }
        if (SA[ISAd + SA[v2]] > SA[ISAd + SA[v3]]) {
            if (SA[ISAd + SA[v1]] > SA[ISAd + SA[v3]]) {
                return v1;
            } else {
                return v3;
            }
        }
        return v2;
    }
84611
function(a, b) {
    a = a.trim().toLowerCase();
    b = b.trim().toLowerCase();

    if (a === b) return 0;
    if (a < b) return 1;

    return -1;
  }
109558
function(vec2, returnNew) {
      var x,y;
      if ('number' !== typeof vec2) {
        x = vec2.x;
        y = vec2.y;

      // Handle incoming scalars
      } else {
        x = y = vec2;
      }

      if (x === 0 || y === 0) {
        throw new Error('division by zero')
      }

      if (isNaN(x) || isNaN(y)) {
        throw new Error('NaN detected');
      }

      if (returnNew) {
        return new Vec2(this.x / x, this.y / y);
      }

      return this.set(this.x / x, this.y / y);
    }
694691
def _get_separated_values(self, secondary=False):
        """"""
        series = self.secondary_series if secondary else self.series
        transposed = list(zip(*[serie.values for serie in series]))
        positive_vals = [
            sum([val for val in vals if val is not None and val >= self.zero])
            for vals in transposed
        ]
        negative_vals = [
            sum([val for val in vals if val is not None and val < self.zero])
            for vals in transposed
        ]
        return positive_vals, negative_vals