From c27e0457903a4075fcd44614d7cae955526e5e9d Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Thu, 9 Apr 2020 15:50:34 -0400 Subject: [PATCH] use full dynamic range of rand() funtion --- numerical_methods/durand_kerner_roots.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numerical_methods/durand_kerner_roots.c b/numerical_methods/durand_kerner_roots.c index 184289b8..d6fbfe2b 100644 --- a/numerical_methods/durand_kerner_roots.c +++ b/numerical_methods/durand_kerner_roots.c @@ -113,7 +113,7 @@ int main(int argc, char **argv) /* initialize root approximations with random values */ if (n < degree - 1) { - s0[n] = get_rand(coeffs[n]) + get_rand(coeffs[n]) * I; + s0[n] = (long double)rand() + (long double)rand() * I; #if defined(DEBUG) || !defined(NDEBUG) fprintf(log_file, "root_%d,", n); #endif