private double getAsNumber(Object value) {
        if (value instanceof Number) {
            return ((Number)value).doubleValue();
        } else if (value instanceof NumericFieldValue) {
            return getAsNumber(((NumericFieldValue)value).getNumber());
        } else if (value instanceof BoolFieldValue) {
            return ((BoolFieldValue)value).getBoolean() ? 1 : 0;
        } else if (value instanceof Boolean) {
            return (Boolean)value ? 1 : 0;
        } else {
            return Double.NaN; //new IllegalStateException("Term '" + value + "' (" + value.getClass() + ") does not evaluate to a number.");
        }
    }
Compare two operands for equality.

@param lhs Left hand side of operation.
@param rhs Right hand side of operation.
@return Wether or not the two operands are equal.
document/src/main/java/com/yahoo/document/select/rule/ComparisonNode.java