summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuotao Fu <l.fu@pengutronix.de>2009-04-16 08:18:33 +0000
committerLuotao Fu <l.fu@pengutronix.de>2009-04-16 08:18:33 +0000
commit85a4462fe937086fce07fd12e367660f13ea5f42 (patch)
tree45b4fed01871a58653cd78759200b1f2c514ac50
parent34ff04c50756668dcc771ad7eb3f8e994c43f542 (diff)
downloadfloatings-85a4462fe937086fce07fd12e367660f13ea5f42.tar.gz
floatings-85a4462fe937086fce07fd12e367660f13ea5f42.tar.xz
* fix error message printing
* always print timing information
-rw-r--r--src/pi8.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pi8.c b/src/pi8.c
index 340ee56..ef49b24 100644
--- a/src/pi8.c
+++ b/src/pi8.c
@@ -225,14 +225,14 @@ int main(int argc, char *argv[])
if (argc != 2)
{
- printf("I need to know how many digits to compute.\n");
+ fprintf(stderr, "I need to know how many digits to compute.\n");
exit(EXIT_FAILURE);
}
size = atol(argv[1]);
if (size <= 0L)
{
- printf("Invalid argument.\n");
+ fprintf(stderr, "Invalid argument.\n");
exit(EXIT_FAILURE);
}
@@ -244,7 +244,7 @@ int main(int argc, char *argv[])
if ((pi == NULL) || (powers == NULL) || (term == NULL))
{
- printf("Unable to allocate enough memory.\n");
+ fprintf(stderr, "Unable to allocate enough memory.\n");
exit(EXIT_FAILURE);
}
@@ -278,9 +278,7 @@ int main(int argc, char *argv[])
Print(pi);
-#ifdef SHOWTIME
printf("\nCalculation time %0.0lf\n", difftime(T2, T1));
-#endif
return EXIT_SUCCESS;
}