Fix signedness warnings

This commit is contained in:
Lucas 2020-03-08 21:34:51 +00:00
parent 85a442f8c3
commit 0f2c695260
3 changed files with 10 additions and 11 deletions

View File

@ -28,7 +28,7 @@
#define MAX_DEGREE 1000 #define MAX_DEGREE 1000
struct poly { struct poly {
unsigned int degree; int degree;
double *coefs; double *coefs;
const char *expr; const char *expr;
}; };
@ -78,7 +78,7 @@ static void
print_fun_body(size_t n, struct poly *polys) print_fun_body(size_t n, struct poly *polys)
{ {
size_t i, j; size_t i, j;
unsigned int d; int d;
printf("\tlong double complex a"); printf("\tlong double complex a");
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
@ -177,7 +177,7 @@ static void
do_poly_div(int argc, char *argv[]) do_poly_div(int argc, char *argv[])
{ {
struct poly p, q; struct poly p, q;
unsigned int i, j, p_degree, q_degree; int i, j, p_degree, q_degree;
if (argc < 2) if (argc < 2)
usage(); usage();
@ -208,7 +208,7 @@ static void
do_newton(int argc, char *argv[]) do_newton(int argc, char *argv[])
{ {
struct poly f, df, p; struct poly f, df, p;
unsigned int i, j, f_degree; int i, j, f_degree;
if (argc < 1) if (argc < 1)
usage(); usage();

10
julia.c
View File

@ -33,7 +33,7 @@ static long double bailout = 1e100,
epsilon = 1e-8, epsilon = 1e-8,
sec_w = 4.0, sec_w = 4.0,
contour = 0.0005L; contour = 0.0005L;
static unsigned long niters = 250; static long niters = 250;
static void static void
print_critical_points(void) print_critical_points(void)
@ -73,7 +73,7 @@ iterate(long double complex z, long double complex c, long double *rit)
{ {
long double complex dz = 1.0L; long double complex dz = 1.0L;
long double t; long double t;
unsigned long i; long i;
for (i = 0; i < niters && cabsl(z) < bailout; i++) { for (i = 0; i < niters && cabsl(z) < bailout; i++) {
dz = df(z) * dz; dz = df(z) * dz;
@ -100,7 +100,7 @@ static long
fast_iterate(long double complex z, long double complex c, long double *rit) fast_iterate(long double complex z, long double complex c, long double *rit)
{ {
long double t; long double t;
unsigned long i; long i;
for (i = 0; i < niters && cabsl(z) < bailout; i++) { for (i = 0; i < niters && cabsl(z) < bailout; i++) {
z = f(z) + c; z = f(z) + c;
@ -151,7 +151,7 @@ julia_main(int argc, char *argv[])
zoom = 1.0, zoom = 1.0,
light, light_x, light_y, light_z, rit, sec_h, zx, zy; light, light_x, light_y, light_z, rit, sec_h, zx, zy;
long long it, idx, ritnum; long long it, idx, ritnum;
unsigned int palette_size = 720, int palette_size = 720,
width = 640, width = 640,
height = 400, height = 400,
i, j; i, j;
@ -184,7 +184,7 @@ julia_main(int argc, char *argv[])
light_intensity = parse_double(optarg); light_intensity = parse_double(optarg);
break; break;
case 'n': case 'n':
niters = parse_integer(optarg, 1, ULONG_MAX); niters = parse_integer(optarg, 1, LONG_MAX);
break; break;
case 'w': case 'w':
width = parse_integer(optarg, 1, 65536); width = parse_integer(optarg, 1, 65536);

View File

@ -83,8 +83,7 @@ int
palette_main(int argc, char *argv[]) palette_main(int argc, char *argv[])
{ {
struct color *palette; struct color *palette;
unsigned int width, height; int ch, i, j, width, height;
int ch, i, j;
height = 100; height = 100;
width = 720; width = 720;