From d4af25db0f40c21c4fcfd1e5a67d56317b686ad7 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 4 Feb 2024 20:44:05 +0100 Subject: [PATCH] logarithm funktion --- src/c/funktionen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index b762515..6ec9a84 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -32,3 +32,13 @@ return cbrt(x); float absolute(float x) { return fabs(x); } + +// Function to calculate the logarithm (base 10) of a number +float logarithm(float x) { +if (x > 0) { +return log10(x); +} else { +printf("Error: Invalid input for logarithm!\n"); +return 0; +} +}