use copysign instead of if_else for round