Add my dist

This commit is contained in:
AZEN-SGG 2025-05-02 04:37:16 +03:00
parent 1053f8e3c2
commit a8b4e4358d
16 changed files with 807 additions and 23 deletions

View file

@ -1,16 +0,0 @@
#ifndef IO_STATUS_H
#define IO_STATUS_H
#define ERR_MEM "Error: Not enough memory!"
#define ERR_OPEN "Error: Cannot open file"
#define ERR_READ "Error: Cannot read file"
#define ERR_FUNC "Error: Algorithm is not applicable!"
typedef enum _io_status
{
SUCCESS,
ERROR_OPEN,
ERROR_READ
} io_status;
#endif

View file

@ -12,8 +12,8 @@ int main(int argc, char *argv[])
int m, k, cl, it, task = 2;
double (*f) (double);
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6, sin}; // TODO: Remove sin
double (*d_lst[]) (double) = {d0, d1, d2, d3, d4, d5, d6, cos}; // TODO: Remove cos
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
double (*d_lst[]) (double) = {d0, d1, d2, d3, d4, d5, d6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
@ -36,13 +36,13 @@ int main(int argc, char *argv[])
cl = get_call_function_count();
if (it > m)
if (it < 0)
{
fprintf(stdout, "%s : Task = %d NOT FOUND Count = %d T = %.2f\n", argv[0], task, cl, t);
return -2;
} else
{
printf("%s : Task = %d X = %e Res = %e Its = %d Count = %d T = %.2f\n", argv[0], task, x, f(x), it, cl, t);
fprintf(stdout, "%s : Task = %d X = %e Res = %e Its = %d Count = %d T = %.2f\n", argv[0], task, x, f(x), it, cl, t);
return 0;
}
}

View file

@ -21,12 +21,15 @@ int t2_solve (
if (fabs(dy) < DBL_EPSILON)
{
it = m+1;
it = -1;
break;
}
x_0 -= (y / dy);
}
if (it > m)
it = -1;
*x = x_0;
return it;