From 0a09383b1eefad0baab83cb424b072538e95572e Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Fri, 2 Feb 2024 15:27:26 +0000 Subject: [PATCH] Added logarithm function for base 10 logarithmic calculations --- src/main/c/main_taschenrechner.c | 9 ++++++++- src/main/c/taschenrechner.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index 20b7c33..9158895 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -39,8 +39,15 @@ double tangentFunction(double angle) { return tan(angle * M_PI / 180.0); } -// scientificmode +// Logarithmic functions +double logarithmFunction(double x) { + // Logarithm with base 10 + return log10(x); +} + + +// scientificmode int scientificMode(){ double num, result; diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index a2b16d0..d177979 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -15,6 +15,8 @@ double cosineFunction(double angle); double tangentFunction(double angle); +double logarithmFunction(double x); + int mode(int userChoice); int displayMenu();