From 03d5c29ff670d1179098b89ca93ad5a8a24ce5e3 Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Fri, 2 Feb 2024 15:40:57 +0000 Subject: [PATCH] Added logarithmBase2Function for base 2 logarithmic calculations --- src/main/c/main_taschenrechner.c | 6 +++++- src/main/c/taschenrechner.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index eb9dad3..6820e7f 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -39,6 +39,7 @@ double tangentFunction(double angle) { return tan(angle * M_PI / 180.0); } +//.. // Logarithmic functions double logarithmFunction(double x) { // Logarithm with base 10 @@ -49,8 +50,11 @@ double naturalLogarithmFunction(double x) { // Natural logarithm (ln) return log(x); } - +double logarithmBase2Function(double x) { + // Logarithm with base 2 + return log2(x); +} // scientificmode int scientificMode(){ diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index 071fba0..1032900 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -22,6 +22,8 @@ double logarithmFunction(double x); double naturalLogarithmFunction(double x); +double logarithmBase2Function(double x); + int mode(int userChoice); int displayMenu();