Divides two numbers, handling undefined values