对比字符串版本号的大小，返回1则v1大于v2，返回-1则v1小于v2，返回0则v1等于v2

@param {string} v1 要进行比较的版本号1
@param {string} v2 要进行比较的版本号2
@returns
328149
function versionCompare(v1, v2) {
    var GTR = 1; //大于
    var LSS = -1; //小于
    var EQU = 0; //等于
    var v1arr = String(v1).split(".").map(function (a) {
        return parseInt(a);
    });
    var v2arr = String(v2).split(".").map(function (a) {
        return parseInt(a);
    });
    var arrLen = Math.max(v1arr.length, v2arr.length);
    var result;

    //排除错误调用
    if (v1 == undefined || v2 == undefined) {
        throw new Error();
    }

    //检查空字符串，任何非空字符串都大于空字符串
    if (v1.length == 0 && v2.length == 0) {
        return EQU;
    } else if (v1.length == 0) {
        return LSS;
    } else if (v2.length == 0) {
        return GTR;
    }

    //循环比较版本号
    for (var i = 0; i < arrLen; i++) {
        result = getResult(v1arr[i], v2arr[i]);
        if (result == EQU) {
            continue;
        } else {
            break;
        }
    }
    return result;

    function getResult(n1, n2) {
        if (typeof n1 != "number") {
            n1 = 0;
        }
        if (typeof n2 != "number") {
            n2 = 0;
        }
        if (n1 > n2) {
            return GTR;
        } else if (n1 < n2) {
            return LSS;
        } else {
            return EQU;
        }
    }
}
1057022
function (version, semverIndex)
	{
		const splittedVersion = version.split('.');
		splittedVersion[ semverIndex ] = parseInt(splittedVersion[ semverIndex ], 10) + 1;
		while (semverIndex < 2)
		{
			splittedVersion[ ++semverIndex ] = '0';
		}
		return splittedVersion.join('.');
	}
356547
def compare_version(v1, v2):
    
    s1 = StrictVersion(v1)
    s2 = StrictVersion(v2)
    if s1 == s2:
        return 0
    elif s1 > s2:
        return -1
    else:
        return 1
792093
public static int compareMavenVersions(String v1, String v2) {
		return parseMavenVersion(v1).compareTo(parseMavenVersion(v2));
	}
766539
public static double[] plusTimesEquals(final double[] v1, final double[] v2, final double s2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    for(int i = 0; i < v1.length; i++) {
      v1[i] += s2 * v2[i];
    }
    return v1;
  }
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);
	}
150227
function compareVersions(installed, required) {

	var a = installed.split('.');
	var b = required.split('.');

	for (var i = 0; i < a.length; ++i) {
		a[i] = Number(a[i]);
	}
	for (var i = 0; i < b.length; ++i) {
		b[i] = Number(b[i]);
	}
	if (a.length == 2) {
		a[2] = 0;
	}

	if (a[0] > b[0]) return true;
	if (a[0] < b[0]) return false;

	if (a[1] > b[1]) return true;
	if (a[1] < b[1]) return false;

	if (a[2] > b[2]) return true;
	if (a[2] < b[2]) return false;

	return true;
}
1286608
function getRegEx(version) {
    switch(version.toLowerCase())
    {
      case 'v1':
        return /^[0-9A-F]{8}-[0-9A-F]{4}-[1][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
      case 'v2':
        return /^[0-9A-F]{8}-[0-9A-F]{4}-[2][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
      case 'v3':
        return /^[0-9A-F]{8}-[0-9A-F]{4}-[3][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
      case 'v4':
        return /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
      case 'v5':
        return /^[0-9A-F]{8}-[0-9A-F]{4}-[5][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
      default:
        return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
    }
  }
28775
public static double[] timesPlusEquals(final double[] v1, final double s1, final double[] v2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    for(int i = 0; i < v1.length; i++) {
      v1[i] = v1[i] * s1 + v2[i];
    }
    return v1;
  }
1347633
public static int compareOsgiVersions(String v1, String v2) {
		return Version.parseVersion(v1).compareTo(Version.parseVersion(v2));
	}
529359
public static int compareVersions(String version_1, String version_2)
	{
		for (int j = 0; j < Math.min(version_2.length(), version_1.length()); j++)
		{

			char v1_c = version_1.charAt(j);
			char v2_c = version_2.charAt(j);

			if (v1_c == v2_c)
			{

				continue;
			}

			if (v2_c == '.')
			{

				// version1 higher (e.g. 10.2 -vs- 1.2)

				return (+1);

			} else if (v1_c == '.')
			{

				// version2 higher ( e.g. 1.2 -vs- 10.2 )

				return (-1);

			} else
			{

				return (v1_c - v2_c);
			}
		}

		// longest one wins. e.g. 1.2.1 -vs- 1.2

		return (version_1.length() - version_2.length());
	}
1373681
def parse_version(v):
    
    parts = v.split(".")
    # Pad the list to make sure there is three elements so that we get major, minor, point
    # comparisons that default to "0" if not given.  I.e. "1.2" --> (1, 2, 0)
    parts = (parts + 3 * ['0'])[:3]
    return tuple(int(x) for x in parts)
1094892
function toVersionString(versions) {
  return Object.keys(versions).sort().filter(key => versions[key]).map((key) => {
    return versions[key] ? `${key}@${versions[key]}` : '';
  }).join(', ');
}
428085
function convertVersionNumber (ver) {
    var hashVersion = {
        '18.0': '1.0.1',
        '18.1': '1.1',
        '26.0': '1.2',
        '28.0': '1.3',
        '30.0': '1.4',
        '32.0': '2.0'
    };
    var rver = ver;
    var sStr = ver.substring(0, 4);
    if (hashVersion[sStr]) {
        rver = hashVersion[sStr];
    }
    return (rver);

}
772020
public static double mul(float v1, float v2) {
		return mul(Float.toString(v1), Float.toString(v2)).doubleValue();
	}
611847
public static double[] timesPlusTimesEquals(final double[] v1, final double s1, final double[] v2, final double s2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    for(int i = 0; i < v1.length; i++) {
      v1[i] = v1[i] * s1 + v2[i] * s2;
    }
    return v1;
  }
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