RELATIVE DIFFERENCE // 
FUNCTION: diff( x, y[, scale] )
Computes the relative difference.

@param {Number} x - first number
@param {Number} y - second number
@param {String|Function} [scale='max-abs'] - scale function
@returns {Number} relative difference
348209
function diff( x, y, scale ) {
	var f;
	var s;
	if ( x !== x || y !== y ) {
		return NaN;
	}
	if (
		x === PINF ||
		x === NINF ||
		y === PINF ||
		y === NINF
	) {
		if ( x === y ) {
			return NaN;
		}
		return PINF;
	}
	// If the absolute difference is `0`, then so is the relative difference:
	if ( x === y ) {
		return 0.0;
	}
	if ( isFunction( scale ) ) {
		f = scale;
	} else {
		if ( scale === void 0 ) {
			scale = 'max-abs';
		}
		f = SCALE[ scale ];
		if ( f === void 0 ) {
			throw new Error( 'invalid input argument. Unrecognized/unsupported scale function. Value: `' + scale + '`.' );
		}
	}
	s = f( x, y );
	if ( s === 0 ) {
		// Bail. No possible return value which works for all possible scale functions...
		return NaN;
	}
	return abs( (x - y) / s );
}
20690
def distCEIL2D(x1,y1,x2,y2):
    """"""
    xdiff = x2 - x1
    ydiff = y2 - y1
    return int(math.ceil(math.sqrt(xdiff*xdiff + ydiff*ydiff)))
352894
function mean( x, y ) {
	x = abs( x );
	y = abs( y );
	return x + (y-x)/2.0;
}
1296727
def get_R_det2(y_segment, y_avg, y_prime):
    
    numerator = sum((numpy.array(y_segment) - numpy.array(y_prime))**2)
    denominator = sum((numpy.array(y_segment) - y_avg)**2)
    if denominator: # prevent divide by zero error
        R_det2 = 1 - (old_div(numerator, denominator))
        return R_det2
    else:
        return float('nan')
137413
def distLinf(x1,y1,x2,y2):
    """"""
    return int(max(abs(x2-x1),abs(y2-y1)))
963842
function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
		return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x);
	}
909506
def diff(var, key):
    ''''''
    global last_diff
    ret = 0
    if not key in last_diff:
        last_diff[key] = var
        return 0
    ret = var - last_diff[key]
    last_diff[key] = var
    return ret
667317
def relative(x, y)
      if x.respond_to?(:to_i) && y.respond_to?(:to_i)
        [@x.min + x.to_i, @y.min + y.to_i]
      else
        x, y = rangeize(x, y)
        [ (@x.min + x.min)..(@x.min + x.max),
          (@y.min + y.min)..(@y.min + y.max) ]
      end
    end
615599
function (y, d) {

        var self = this;
        y = makeCompareFunction(y, d);
        return extend(function (a, b) {

            return self(a, b) || y(a, b);
        });
    }
202174
function getDistanceVector(position1, position2) {
  if (position1 && position2) {
    var x1 = position1.x,
        y1 = position1.y;
    var x2 = position2.x,
        y2 = position2.y;


    return { x: x2 - x1, y: y2 - y1 };
  } else {
    return { x: 0, y: 0 };
  }
}
371837
function compareNumericWithNaNs(x, y) {
    if (!isNaN(x) && !isNaN(y))
      return x - y;
    if (isNaN(x))
      return 1;
    if (isNaN(y))
      return -1;
    return 0;
  }
174649
def _diff(self, x, th, eps):
        
        foo = lambda y: self.igen(numpy.sum(self.gen(y, th), 0), th)

        out1 = out2 = 0.
        sign = 1 - 2*(x > .5).T
        for I in numpy.ndindex(*((2,)*(len(x)-1)+(1,))):

            eps_ = numpy.array(I)*eps
            x_ = (x.T + sign*eps_).T
            out1 += (-1)**sum(I)*foo(x_)

            x_[-1] = 1
            out2 += (-1)**sum(I)*foo(x_)

        out = out1/out2
        return out
1160956
function(a,b,d){
	var o, dir;
	if(arguments.length == 3){
		Vec2D.apply(this,[a,b]);
		this.dir = d.getNormalized();
	} else if(arguments.length == 2){
		Vec2D.apply(this,[a]);
		this.dir = b.getNormalized();
	} else if(arguments.length === 0){
		Vec2D.apply(this);
		this.dir = Vec2D.Y_AXIS.copy();
	}
}
319683
static public double F2(double x, double y) {
    double temp1 = (x * x) - y;
    double temp2 = x - 1.0;
    return ((100.0 * temp1 * temp1) + (temp2 * temp2));
  }
784109
function (pt1, pt2) {
	return Math.sqrt((pt2.x -= pt1.x) * pt2.x + (pt2.y -= pt1.y) * pt2.y);
}
37306
function diff( a, b ) {
	var result = a.slice();
	for ( var i = 0; i < result.length; i++ ) {
		for ( var j = 0; j < b.length; j++ ) {
			if ( result[i] === b[j] ) {
				result.splice(i, 1);
				i--;
				break;
			}
		}
	}
	return result;
}
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;
    }