Programm is compiling

This commit is contained in:
AZEN-SGG 2025-04-30 12:01:55 +03:00
parent 135f27f63d
commit 8e114b5c29
17 changed files with 328 additions and 90 deletions

View file

@ -2,18 +2,17 @@
#include "status.h"
#include <math.h>
#include <float.h>
status t1_solve (
double (*f) (double),
double a, double b,
double eps, int m, double *x,
int *m_cl, int *m_it
double eps, int m, double *x, int *m_it
) {
static int it = 0
int cl = 0;
double y_a = f(a), y_b = f(b);
it++;
int it = 0;
status ret = SUCCESS;
double c = DBL_MAX, y, y_a = f(a), y_b = f(b);
if (y_a * y_b >= -DBL_EPSILON)
{
@ -21,14 +20,18 @@ status t1_solve (
return MORE_ONE_ROOT;
}
for (cl = 0; cl < m; ++cl)
for (it = 0; it < m; ++it)
{
double c = (a + b) * 0.5;
double y = f(c);
c = (a + b) * 0.5;
y = f(c);
if (fabs(y) < eps)
{
*x = c;
ret = SUCCESS;
break;
} else if ((fabs(c - a) < DBL_EPSILON) || (fabs(c - b) < DBL_EPSILON))
{
ret = HIGH_ERROR;
break;
} else if (y * y_a > DBL_EPSILON)
{
@ -41,13 +44,12 @@ status t1_solve (
}
}
*m_it = it;
*cl = cl;
if (it >= m)
ret = RUN_TIME;
*x = c;
*m_it = it;
if (cl >= m)
return RUN_TIME;
return SUCCESS;
return ret;
}