Commit 70cd66e8 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(main): Use %g instead of %f to print the numbers, to avoid overflow

	problems in the %f representation.
parent ec7ee9fa
......@@ -50,22 +50,22 @@ main(void)
}
/* No overflow. */
printf("Garb busy postponement: %f seconds\n", (double)tv.tv_sec);
printf("Garb busy postponement: %g seconds\n", (double)tv.tv_sec);
/* Overflow. */
printf("Garb timeout: %f seconds\n", 1.5 * (double)tv.tv_sec);
printf("Garb timeout: %g seconds\n", 1.5 * (double)tv.tv_sec);
/* Overflow. */
printf("Sync timeout: %f seconds\n", 1.1 * (double)tv.tv_sec);
printf("Sync timeout: %g seconds\n", 1.1 * (double)tv.tv_sec);
/* Overflow. */
printf("Garb interval: %f days\n", (double)tv.tv_sec / 24.0 / 3599.0);
printf("Garb interval: %g days\n", (double)tv.tv_sec / 24.0 / 3599.0);
/* No overflow. */
printf("Sync interval: %f days\n", (double)tv.tv_sec / 24.0 / 3601.0);
printf("Sync interval: %g days\n", (double)tv.tv_sec / 24.0 / 3601.0);
/* Overflow. */
printf("Sync retry interval: %f us\n", 1.001e6 * tv.tv_sec);
printf("Sync retry interval: %g us\n", 1.001e6 * tv.tv_sec);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment