Browse Source

refactoring: change parameter and variable names

master
fdai7848 11 months ago
parent
commit
32b27094cf
  1. 25
      src/reihen.c
  2. 6
      src/reihen.h

25
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;

6
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
Loading…
Cancel
Save