From 9ea7adab37a901057cbe44a3f4833d4ebf39bbab Mon Sep 17 00:00:00 2001 From: fdai7968 Date: Thu, 8 Feb 2024 16:20:42 +0000 Subject: [PATCH] refactoring: if dividend is 0 return 0 without calculation --- src/division/division.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/division/division.c b/src/division/division.c index ee1e7cf..7cf98ef 100644 --- a/src/division/division.c +++ b/src/division/division.c @@ -4,5 +4,6 @@ float divide(float dividend, float divisor) { if (divisor == 0) { return 0; // Fehlerbehandlung: Division durch Null ist nicht definiert, daher geben wir einfach 0 zurück. } - return dividend / divisor; + if (dividend == 0) return 0; + else return dividend / divisor; }