From 5d9f67387089979c63600b183b3e223eb53a6783 Mon Sep 17 00:00:00 2001 From: Khaled Date: Sun, 4 Feb 2024 21:41:45 +0100 Subject: [PATCH] naturalLogarithmPlusOne --- src/c/funktionen.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index 64a3479..3d33778 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -143,3 +143,14 @@ float logarithmPlusOne(float x) { } } +// Function to calculate the natural logarithm (base e) of a number and add 1 +float naturalLogarithmPlusOne(float x) { + if (x > 0) { + return log(x) + 1; + } + else { + printf("Error: Invalid input for natural logarithm + 1!\n"); + return 0; + } +} +