Implement AND, OR, XOR, NEG operations in r_num_calc()