Task 8 is done
This commit is contained in:
parent
2efd819d0f
commit
98a608ce96
22 changed files with 1270 additions and 0 deletions
34
2025.04.18/08Ex/main.c
Normal file
34
2025.04.18/08Ex/main.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "io_status.h"
|
||||
#include "solve.h"
|
||||
|
||||
/* ./a.out x eps */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
double x, eps, t, r1 = 0, r2 = 0;
|
||||
int task = 8;
|
||||
|
||||
if (
|
||||
!((argc == 3) &&
|
||||
((sscanf(argv[1], "%le", &x) == 1) && x > 0) &&
|
||||
((sscanf(argv[2], "%le", &eps) == 1) && eps > 0))
|
||||
) {
|
||||
fprintf(stderr, "Usage: %s x eps\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
t = clock();
|
||||
r1 = dln(x, eps);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
|
||||
r2 = fabs(r1 - log(x));
|
||||
|
||||
printf("%s : Task = %d Result = %e Residual = %e Elapsed = %.2f\n", argv[0], task, r1, r2, t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue