Task 6 and 7 are done!
This commit is contained in:
parent
2f21a20fd1
commit
2efd819d0f
16 changed files with 334 additions and 4 deletions
39
2025.04.18/06Ex/solve.c
Normal file
39
2025.04.18/06Ex/solve.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "solve.h"
|
||||
#include "contin_func.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
double fcos (double x, const double eps)
|
||||
{
|
||||
double answer;
|
||||
short flag = 1;
|
||||
|
||||
if (x - M_PI*2 >= DBL_EPSILON)
|
||||
x = fmod(x, M_PI*2);
|
||||
|
||||
if (x - M_PI >= DBL_EPSILON)
|
||||
{
|
||||
x -= M_PI;
|
||||
flag *= -1;
|
||||
}
|
||||
|
||||
if (x - 1 >= DBL_EPSILON)
|
||||
{
|
||||
x -= M_PI_2;
|
||||
flag *= -2;
|
||||
}
|
||||
|
||||
if (abs(flag) == 2)
|
||||
{
|
||||
x /= 2;
|
||||
|
||||
answer = ((flag > 0) - (flag < 0)) * (2 * ssin(x, eps) * scos(x, eps));
|
||||
} else
|
||||
answer = flag * scos(x, eps);
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue