From e46b1357b3af8d0e343da863be820fb5a6bc5716 Mon Sep 17 00:00:00 2001 From: Khaled Date: Sun, 4 Feb 2024 21:28:01 +0100 Subject: [PATCH] logarithmPlusOne --- src/c/funktionen.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index b069db3..64a3479 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -132,3 +132,14 @@ float radiansToDegrees(float x) { return x * (180 / M_PI); } +// Function to calculate the base 10 logarithm of a number and add 1 +float logarithmPlusOne(float x) { + if (x > 0) { + return log10(x) + 1; + } + else { + printf("Error: Invalid input for logarithm + 1!\n"); + return 0; + } +} +