From 32b27094cf1565c777dd2b28318fdb16502fa86c Mon Sep 17 00:00:00 2001 From: fdai7848 Date: Sat, 3 Feb 2024 20:30:44 +0100 Subject: [PATCH] refactoring: change parameter and variable names --- src/reihen.c | 25 +++++++++++++------------ src/reihen.h | 6 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/reihen.c b/src/reihen.c index 5fe2d8c..649814a 100644 --- a/src/reihen.c +++ b/src/reihen.c @@ -20,10 +20,10 @@ unsigned long long fac(int x){ return prod; } -double exponential(double x){ +double exponential(double exp){ double sum = 0.0; for(int i = 0; i<=21; i++){ - sum += (1.0/fac(i)*(powerD(i,x))); + sum += (1.0/fac(i)*(powerD(i,exp))); } return sum; } @@ -32,13 +32,13 @@ double euler(){ return exponential(1); } -double squashDegreesTo360(double x){ - int multiple = x / 360; - return x - (360*multiple); +double squashDegreesTo360(double degrees){ + int multiple = degrees / 360; + return degrees - (360*multiple); } -double radians(double d){ - return d * PI / 180; +double radians(double degrees){ + return degrees * PI / 180; } double pi(double eps){ @@ -56,19 +56,20 @@ double pi(double eps){ return pi; } -double sinD(double x){ - if (x>=360.0){ - x = squashDegreesTo360(x); +double sinD(double degrees){ + + if (degrees>=360.0){ + degrees = squashDegreesTo360(degrees); } double sum = 0.0; double currvalue; - x = radians(x); + double radian = radians(degrees); double power; unsigned long long faculty; for (int i = 0; i <= 9; i++) { currvalue = 1.0; - currvalue *= powerD(2*i+1,x); + currvalue *= powerD(2*i+1, radian); currvalue /= (double) fac(2*i+1); if(i%2==0) sum += currvalue; else sum -= currvalue; diff --git a/src/reihen.h b/src/reihen.h index f056dfe..d9cdf38 100644 --- a/src/reihen.h +++ b/src/reihen.h @@ -1,10 +1,10 @@ #ifndef REIHEN_H #define REIHEN_H -double exponential(double x); +double exponential(double exp); double euler(); double pi(); -double radians(double d); -double sinD(double d); +double radians(double degrees); +double sinD(double degrees); #endif // reihen.h \ No newline at end of file