When either operand is a double, division produces a double result with the fractional part. double result = 7.0 / 2.0; stores 3.5. This matches standard math. You can force floating-point division by casting: double result = static_cast<double>(7) / 2; converts 7 to 7.0 before dividing.
Without the cast, 7 / 2 evaluates to 3 first. Dividing by zero with floating-point produces inf, not a crash. double x = 5.0 / 0.0; stores infinity. Check for zero denominators to avoid invalid results.