From 48a934bb57524c589bfe69653058cca8e3be0a96 Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Wed, 7 Jan 2026 20:03:55 +0000 Subject: Give int conversion functions better names. --- charf.c | 12 ++++++------ double-error.c | 6 +++--- double-error.h | 4 ++-- double.c | 4 ++-- double.h | 4 ++-- ratio.c | 4 ++-- ratio.h | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/charf.c b/charf.c index 6c8943b..3dd9d5e 100644 --- a/charf.c +++ b/charf.c @@ -28,7 +28,7 @@ #define EXPTYPE double #endif -/*length of the support of f*/ +/*maximum length of the support of f*/ static const int N=16; /*given function df[0] on domain [0,M-1], compute derivatives f' until f^{(K)} and store f^{(K)} in df*/ @@ -54,7 +54,7 @@ void differentiate(VALUETYPE* f, VALUETYPE* df, int D, int K){ /*given function f on domain [0,D-1] compute pth root of integral of |f|^p*/ VALUETYPE integratep(VALUETYPE* f, EXPTYPE p, int D){ - VALUETYPE integralp = convert_int(0); + VALUETYPE integralp = int_to_valuetype(0); for(int i=0;i> n) & 1); + for(int n=0; n> n) & 1); return d; } } @@ -189,7 +189,7 @@ int generate_function(VALUETYPE* f, int i){ void* compute_chunk(void* arguments){ int i = *((int*)arguments); int K = 3; - EXPTYPE p = to_exptype(1); + EXPTYPE p = int_to_exptype(1); VALUETYPE f[N]; int d = generate_function(f,i); @@ -202,7 +202,7 @@ void* compute_chunk(void* arguments){ int main() { /*exponent p of the L^p norm to consider*/ - EXPTYPE p = to_exptype(1); + EXPTYPE p = int_to_exptype(1); pthread_t threads[NUM_THREADS]; int args[NUM_THREADS]; diff --git a/double-error.c b/double-error.c index d5bac3d..7d11a92 100644 --- a/double-error.c +++ b/double-error.c @@ -7,14 +7,14 @@ typedef struct {double v; double e;} double_error; -double_error convert_int(int i){ +double_error int_to_valuetype(int i){ double_error de; de.v = (double) i; de.e = EPS*abs(i); return de; } -double_error to_exptype(double d){ +double_error int_to_exptype(double d){ double_error de; de.v = d; de.e = EPS*fabs(d) + DBL_MIN; @@ -110,7 +110,7 @@ double_error power(double_error de, double_error p) { double to_double(double_error de){ return de.v; } bool root_to_string(char* s, double_error de, double_error p){ - double_error de1p = power(de,ratio(convert_int(1),p)); + double_error de1p = power(de,ratio(int_to_valuetype(1),p)); to_string(s,de1p); return true; } diff --git a/double-error.h b/double-error.h index 23b78d9..bacc8e7 100644 --- a/double-error.h +++ b/double-error.h @@ -1,8 +1,8 @@ typedef struct {double v; double e;} double_error; -double_error convert_int(int); +double_error int_to_valuetype(int); -double_error to_exptype(double); +double_error int_to_exptype(double); bool is_greater(double_error,double_error); diff --git a/double.c b/double.c index f86a586..1572759 100644 --- a/double.c +++ b/double.c @@ -2,9 +2,9 @@ #include #include -double convert_int(int i){ return (double) i; } +double int_to_valuetype(int i){ return (double) i; } -double to_exptype(double d){ return d; } +double int_to_exptype(double d){ return d; } double sum(double d1, double d2){ return d1+d2; } diff --git a/double.h b/double.h index 98949b1..9a26970 100644 --- a/double.h +++ b/double.h @@ -1,6 +1,6 @@ -double convert_int(int); +double int_to_valuetype(int); -double to_exptype(double); +double int_to_exptype(double); bool is_greater(double,double); diff --git a/ratio.c b/ratio.c index 3b38ea7..ad2b0ea 100644 --- a/ratio.c +++ b/ratio.c @@ -28,7 +28,7 @@ num safe_product(num n1, num n2){ } } -rational convert_int(int i){ +rational int_to_valuetype(int i){ rational r; r.d = 1; r.n = abs(i); @@ -36,7 +36,7 @@ rational convert_int(int i){ return r; } -unsigned int to_exptype(unsigned int i){ return i; } +unsigned int int_to_exptype(unsigned int i){ return i; } num gcd(num a, num b){ num c; diff --git a/ratio.h b/ratio.h index cd50c8e..1f54781 100644 --- a/ratio.h +++ b/ratio.h @@ -4,9 +4,9 @@ typedef struct {bool s; unsigned long long n; unsigned long long d;} rational; -rational convert_int(int); +rational int_to_valuetype(int); -unsigned int to_exptype(unsigned int); +unsigned int int_to_exptype(unsigned int); bool is_greater(rational,rational); -- cgit v1.2.3