guarding against potential division by zero