Performs the equivalent of $val1 / $val2
@param ValueProxy $val1
@param ValueProxy $val2
@return ValueProxy
963071
public static function OperatorDivide( $val1, $val2 )
	{
		switch ( ValueProxy::$conv_t[ $val1->GetValueCode() ][ $val2->GetValueCode()] )
		{
			case -1:
				return  $val2->Promote( $val1)->Div( $val2 );

			case 0:
				return  $val1->Div( $val2 );

			case 1:
				return  $val1->Div( $val1->Promote( $val2 ) );

			default:
				{
					if ( ValueProxy::$conv_t[ $val2->GetValueCode() ][ $val1->GetValueCode() ] == 1)
						return  $val2->Promote( $val1 )->Div( $val2 );
					throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
						array(
							"op:div",
							SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject(  $val1 ), XmlTypeCardinality::One ),
							SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject(  $val2 ), XmlTypeCardinality::One )
						)
					);
				}
		}
	}
326722
public static function areSameType($value1, $value2): bool
    {
        if (!is_object($value1) || !is_object($value2)) {
            return gettype($value1) === gettype($value2);
        }

        return get_class($value1) === get_class($value2);
    }
1061973
protected function Promote( $val )
	{
		if ( ! $val instanceof ValueProxy ) throw new \InvalidArgumentException();
		return new IntProxy( Convert::ToInt32( $val->getValue() ) );
	}
912419
protected function TryGt( $val, &$res )
	{
		$res = false;
		if ( ! $val instanceof ValueProxy ) return false;
		if ( $val->GetValueCode() != $this->GetValueCode() ) return false;

		$res = $this->Gt( $val );
		return true; // This SHOULD return true to indicate the comparison was successful
	}
924466
public static function areEqual($value1, $value2): bool
    {
        if (static::isEquatable($value1) && static::areSameType($value1, $value2)) {
            return $value1->equals($value2);
        }

        return $value1 == $value2;
    }
667941
protected function Add( $val )
	{
		$result = $this->_value->getValue() + $val->getValue()->getValue();
	    return new LongProxy( new Long( $result ) );
	}
663113
protected function Div( $val )
	{
		if  (! $val->getIsNumeric() ) return $this;
		$value1 = $this->ToDecimal( null );
		$value2 = $val->ToDecimal( null );
		return $value1->Div( $value2 );
	}
447564
private function compareDate(DateTime $value1, DateTime $value2, $operator)
    {
        $diff = $value1->format('U') - $value2->format('U');
        switch ($operator) {
            case FieldExpression::EQUALS:
                return $diff === 0;
            case FieldExpression::NOT_EQUALS:
                return $diff !== 0;

            case FieldExpression::GT:
                return $diff > 0;

            case FieldExpression::LT:
                return $diff < 0;
        }

        $errMsg = 'unknown field operator';
        throw new InvalidArgumentException($errMsg);
    }
1194843
protected function Mul( $val )
	{
		if ( ! $val instanceof ValueProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value * $val->getValue() );
	}
1275178
public static function areEqual($value1, $value2) : bool
    {
        return $value1 === $value2 || self::hash($value1) === self::hash($value2);
    }
582778
protected function Mul( $val )
	{
		if ( ! $val instanceof ByteProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value * $val->_value );
	}
25016
public function between($field, $value1, $value2)
    {
        $this->filters[] = sprintf('%s::bt(%s,%s)', $field, $value1, $value2);
    }
800327
public static function distance(Vector $value1, Vector $value2) : float {
        return sqrt(self::distance2($value1, $value2));
    }
667320
public function notBetween($col, $val1, $val2)
    {
        $this->addClause($col, __FUNCTION__, array($val1, $val2));

        return $this;
    }
512975
public function bitXor( $value1, $value2 )
    {
        $value1 = $this->getIdentifier( $value1 );
        $value2 = $this->getIdentifier( $value2 );
        return "( {$value1} + {$value2} - bitand( {$value1}, {$value2} ) * 2 )";
    }
311503
public static function compare($price1, $price2)
    {
        //====================================================================//
        // Check Both Prices are valid
        if (!self::isValid($price1) || !self::isValid($price2)) {
            Splash::log()->war(__FUNCTION__." : Given Prices are invalid");
            if (!self::isValid($price1)) {
                Splash::log()->www(__FUNCTION__." Price 1", $price1);
            }
            if (!self::isValid($price2)) {
                Splash::log()->www(__FUNCTION__." Price 2", $price2);
            }

            return false;
        }
        //====================================================================//
        // Compare Base Price
        if (((bool) $price1["base"]) != ((bool) $price2["base"])) {
            return false;
        }
        //====================================================================//
        // Compare Price
        return self::compareAmounts($price1, $price2);
    }
302547
private function compareLong($value1, $value2, $operator)
    {
        switch ($operator) {
            case FieldExpression::EQUALS:
                return $value1 === $value2;

            case FieldExpression::NOT_EQUALS:
                return $value1 !== $value2;

            case FieldExpression::GT:
                return $value1 > $value2;

            case FieldExpression::LT:
                return $value1 < $value2;
        }

        $errMsg = 'unknown field operator';
        throw new InvalidArgumentException($errMsg);
    }