Add nan check in binary operator