generalized binary operations and added compare operation