calculate the exponent of the left value

@param left value to get exponent from
@param right exponent count
@return return expoinended value
@throws PageException
501313
public static double exponent(Object left, Object right) throws PageException {
	return StrictMath.pow(Caster.toDoubleValue(left), Caster.toDoubleValue(right));
    }
1311648
public Page<E> pageNum(int pageNum) {
        //分页合理化，针对不合理的页码自动处理
        this.pageNum = ((reasonable != null && reasonable) && pageNum <= 0) ? 1 : pageNum;
        return this;
    }
877913
public static int compare(String left, String right) {
	if (Decision.isNumber(left)) {
	    if (Decision.isNumber(right)) {
		// long numbers
		if (left.length() > 9 || right.length() > 9) {
		    try {
			return new BigDecimal(left).compareTo(new BigDecimal(right));
		    }
		    catch (Throwable t) {
			ExceptionUtil.rethrowIfNecessary(t);
		    }
		}
		return compare(Caster.toDoubleValue(left, Double.NaN), Caster.toDoubleValue(right, Double.NaN));
	    }

	    return compare(Caster.toDoubleValue(left, Double.NaN), right);
	}
	if (Decision.isBoolean(left)) return compare(Caster.toBooleanValue(left, false) ? 1D : 0D, right);
	// NICE Date compare, perhaps datetime to double
	return left.compareToIgnoreCase(right);
    }
42605
public GroovyExpression generateArithmeticExpression(GroovyExpression left, String operator,
            GroovyExpression right) throws AtlasException {
        ArithmeticOperator op = ArithmeticOperator.lookup(operator);
        return new ArithmeticExpression(left, op, right);
    }
1241322
public static int compareVersions(Object[] left, Object[] right) {
        if (left == null || right == null) {
            throw new IllegalArgumentException("Invalid versions");
        }

        for (int i = 0; i < left.length; i++) {
            // right is shorter than left and share the same prefix => left must be larger
            if (right.length == i) {
                return 1;
            }

            if (left[i] instanceof Integer) {
                if (right[i] instanceof Integer) {
                    // compare two numbers
                    if (((Integer) left[i]) > ((Integer) right[i])) {
                        return 1;
                    } else if (((Integer) left[i]) < ((Integer) right[i])) {
                        return -1;
                    }
                    else {
                        continue;
                    }
                }
                else {
                    // numbers always greater than alphanumeric tags
                    return 1;
                }
            }
            else if (right[i] instanceof Integer) {
                // alphanumeric tags always less than numbers
                return -1;
            }
            else {
                // compare two alphanumeric tags lexicographically
                int cmp = ((String) left[i]).compareTo((String) right[i]);
                if (cmp != 0) {
                    return cmp;
                }
                else {
                    // two alphanumeric tags are the same... so keep comparing
                    continue;
                }
            }
        }

        // left is shorter than right and share the same prefix, must be less
        if (left.length < right.length) {
            return -1;
        }

        // samesies
        return 0;
    }
635262
public static int compareFlags(int left, int right) {
		if (left == right) {
			return 0;
		}
		int leftSuccess = left & SUCCESS_OR_LAMBDA;
		int rightSuccess = right & SUCCESS_OR_LAMBDA;
		if (leftSuccess != rightSuccess) {
			if (leftSuccess == 0)
				return 1;
			if (rightSuccess == 0)
				return -1;
			if (leftSuccess < rightSuccess)
				return -1;
			return 1;
		}
		if ((left & SYNONYM) != (right & SYNONYM)) {
			if ((left & SYNONYM) != 0)
				return 1;
			return -1;
		}
		return 0;
	}
946419
public static int totalPage(int totalCount, int pageSize) {
		if (pageSize == 0) {
			return 0;
		}
		return totalCount % pageSize == 0 ? (totalCount / pageSize) : (totalCount / pageSize + 1);
	}
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }
1293478
public int compare(@Nonnull Value left, @Nonnull Value right) {
    // First compare the types.
    TypeOrder leftType = TypeOrder.fromValue(left);
    TypeOrder rightType = TypeOrder.fromValue(right);
    int typeComparison = leftType.compareTo(rightType);
    if (typeComparison != 0) {
      return typeComparison;
    }

    // So they are the same type.
    switch (leftType) {
      case NULL:
        return 0; // Nulls are all equal.
      case BOOLEAN:
        return Boolean.compare(left.getBooleanValue(), right.getBooleanValue());
      case NUMBER:
        return compareNumbers(left, right);
      case TIMESTAMP:
        return compareTimestamps(left, right);
      case STRING:
        return compareStrings(left, right);
      case BLOB:
        return compareBlobs(left, right);
      case REF:
        return compareResourcePaths(left, right);
      case GEO_POINT:
        return compareGeoPoints(left, right);
      case ARRAY:
        return compareArrays(left, right);
      case OBJECT:
        return compareObjects(left, right);
      default:
        throw new IllegalArgumentException("Cannot compare " + leftType);
    }
  }
678494
public static int compare(Date left, String right) throws PageException {
	if (Decision.isNumber(right)) return compare(left.getTime() / 1000, Caster.toDoubleValue(right));
	DateTime dt = DateCaster.toDateAdvanced(right, DateCaster.CONVERTING_TYPE_OFFSET, null, null);
	if (dt != null) {
	    return compare(left.getTime() / 1000, dt.getTime() / 1000);
	}
	return Caster.toString(left).compareToIgnoreCase(right);
    }
1161337
public static <L, R> Either<L, R> Left(L value) {
		return new Left<L, R>(value);
	}
88543
public Diff compare(String left, String right) {
		return compare(getCtType(left), getCtType(right));
	}
90694
public BigRational pow(int exponent) {
		if (exponent == 0) {
			return ONE;
		}
		if (exponent == 1) {
			return this;
		}

		final BigInteger n;
		final BigInteger d;
		if (exponent > 0) {
			n = numerator.toBigInteger().pow(exponent);
			d = denominator.toBigInteger().pow(exponent);
		}
		else {
			n = denominator.toBigInteger().pow(-exponent);
			d = numerator.toBigInteger().pow(-exponent);
		}
		return valueOf(n, d);
	}
450109
public static Object div(Object left, BigDecimal right) {
        return right == null || right.signum() == 0 ? null : InfixOpNode.div(left, right, null);
    }
47808
public static long addWithOverflow(Slice left, Slice right, Slice result)
    {
        boolean leftNegative = isNegative(left);
        boolean rightNegative = isNegative(right);
        long overflow = 0;
        if (leftNegative == rightNegative) {
            // either both negative or both positive
            overflow = addUnsignedReturnOverflow(left, right, result, leftNegative);
            if (leftNegative) {
                overflow = -overflow;
            }
        }
        else {
            int compare = compareAbsolute(left, right);
            if (compare > 0) {
                subtractUnsigned(left, right, result, leftNegative);
            }
            else if (compare < 0) {
                subtractUnsigned(right, left, result, !leftNegative);
            }
            else {
                setToZero(result);
            }
        }
        return overflow;
    }
391554
private Ref eqvOp() throws PageException {
	Ref ref = xorOp();
	while (cfml.forwardIfCurrent("eqv")) {
	    cfml.removeSpace();
	    ref = new EQV(ref, xorOp(), limited);
	}
	return ref;
    }
415568
public function onArithmeticExpression($expressionType, $left, $right)
    {
        $type = $this->unpackExpressionType($expressionType);
        switch ($type) {
            case ExpressionType::MULTIPLY:
                return $this->prepareBinaryExpression(self::MULTIPLY, $left, $right);
            case ExpressionType::DIVIDE:
                return $this->prepareBinaryExpression(self::DIVIDE, $left, $right);
            case ExpressionType::MODULO:
                return $this->prepareBinaryExpression(self::MODULO, $left, $right);
            case ExpressionType::ADD:
                return $this->prepareBinaryExpression(self::ADD, $left, $right);
            case ExpressionType::SUBTRACT:
                return $this->prepareBinaryExpression(self::SUBTRACT, $left, $right);
            default:
                throw new \InvalidArgumentException('onArithmeticExpression');
        }
    }