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

10
julia.c
View File

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

View File

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