Skip to content
Snippets Groups Projects
Commit b2012cb0 authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

Fixed printf() parameter issue.

parent 66f10d33
No related branches found
No related tags found
No related merge requests found
......@@ -7,10 +7,9 @@ double func(double x) {
return x * sin(x) - 1;
}
#define BISEC(exponent) (bisec(&func, 0, 2, pow(10, -1.0 * exponent), &steps))
int main(int argc, char *argv[]) {
unsigned int steps, i, begin, end;
double bisection;
if( argc != 3 ) {
printf("Usage: %s BEGIN END\n", argv[0]);
......@@ -20,8 +19,10 @@ int main(int argc, char *argv[]) {
begin = atoi(argv[1]);
end = atoi(argv[2]);
for( i = begin; i <= end; i++ )
printf("zero point: %.30f for epsilon = 1e-%d (%d steps)\n", BISEC(i), i, steps);
for( i = begin; i <= end; i++ ) {
bisection = bisec(&func, 0, 2, pow(10, -1.0 * i), &steps);
printf("zero point: %.30f for epsilon = 1e-%d (%d steps)\n", bisection, i, steps);
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment