11#define PI 3.14159265358979324
26#define ln10 2.30258509299404590109
41#define MAX_double 1.7976931348623158e308
59double floor(
double x);
63double fmod(
double x,
double y);
67double pow(
double base,
double exp);
88double delete (
double x);
107 return sin(
PI / 2 - x);
116double delete (
double x) {
117 while (x >
PI || x < -
PI) {
118 x += x >
PI ? -2 *
PI : 2 *
PI;
130 double result = x, temp = x;
133 result = -1 * result * x * x / (2 * i * (2 * i + 1));
147 double temp, c =
cos(x);
151 temp /= _special.
pow;
152 return (x != -
PI / 2 && x !=
PI / 2) ? temp :
NAN;
162 double temp = x < 0 ? -x : x;
163 for (i = 0; i < temp; i++) {
165 return x < 0 ? -i + 1 : i;
175 double temp = x < 0 ? -x : x;
176 for (i = 0; i < temp; i++) {
178 return x < 0 ? -i : x == 0 ? 0 : i - 1;
188 temp = (x < 1 && x > -1) ?
atan_1_1(x) : temp;
189 temp = x == 1 ?
PI / 4 : x == -1 ? -
PI / 4 : x == 0 ? 0 : temp;
203 double result = x, temp = x, i = 1;
205 result = -1 * result * x * x * (2 * i - 1) / (2 * i + 1);
218 return (x <= 1 && x >= -1)
229 double result = x, temp = x;
232 if (x < -1 || x > 1) {
236 if (x == 1 || x == -1) {
241 x * x * (2 * i - 1) * (2 * i) * (2 * i - 1) / ((2 * i + 1) * 4 * i * i);
254double fmod(
double x,
double y) {
255 double result =
fabs(x);
259 result =
fabs(x) - y * i;
262 return x < 0 ? -result : result;
271 double result = 1, temp = 1;
287 temp = flag == 1 ? temp >
MAX_double ? 0 : 1. / temp : temp;
309 double result = x, temp = x;
312 result *= -x * (i - 1) / i;
340 double result = 4, temp = 0;
341 while (
fabs(result - temp) >
EPS) {
347 result = (temp + x / temp) / 2;
358double pow(
double base,
double vexp) {
360 result =
exp(vexp *
log(base));
369double fabs(
double x) {
return x < 0 ? x *= -1. : x; }
380 _special->
sign = x < 0 ? -1 : 1;
388 }
else if (x < 1 && x > 0) {
406int min(
int a,
int b) {
return a > b ? b : a; }
413double fmin(
double a,
double b) {
return a > b ? b : a; }
421int max(
int a,
int b) {
return a < b ? b : a; }
428double fmax(
double a,
double b) {
return a < b ? b : a; }
double log_other(double x)
Definition math.h:325
#define INF
Represents positive infinity for double-precision floating-point numbers.
Definition math.h:31
double fmin(double a, double b)
Returns the smaller of two double values.
Definition math.h:413
double atan(double x)
Calculates the arctangent of x.
Definition math.h:186
double ceil(double x)
Calculates the smallest integer value greater than or equal to x.
Definition math.h:160
#define ln10
The natural logarithm of 10.
Definition math.h:26
double log_0_2(double x)
Definition math.h:307
double fmax(double a, double b)
Returns the larger of two double values.
Definition math.h:428
double fmod(double x, double y)
Calculates the floating-point remainder of x/y.
Definition math.h:254
double atan_1_1(double x)
Definition math.h:202
#define PI
The mathematical constant Pi (π).
Definition math.h:11
double cos(double x)
Calculates the cosine of an angle (in radians).
Definition math.h:105
double floor(double x)
Calculates the largest integer value less than or equal to x.
Definition math.h:173
#define EPS
A small epsilon value used for floating-point comparisons.
Definition math.h:21
#define NAN
Represents "Not a Number" for double-precision floating-point numbers.
Definition math.h:36
double pow(double base, double exp)
Calculates the base raised to the power of the exponent (base^exp).
Definition math.h:358
double fabs(double x)
Calculates the absolute value of a double.
Definition math.h:369
double tan(double x)
Calculates the tangent of an angle (in radians).
Definition math.h:145
double asin(double x)
Calculates the arcsine of x.
Definition math.h:228
double sin(double x)
Calculates the sine of an angle (in radians).
Definition math.h:128
double sqrt(double x)
Calculates the square root of x.
Definition math.h:339
int min(int a, int b)
Returns the smaller of two integer values.
Definition math.h:406
#define MAX_double
The maximum representable value for a double-precision floating-point number.
Definition math.h:41
double log(double x)
Calculates the natural logarithm of x (ln(x)).
Definition math.h:296
double exp(double x)
Calculates the base-e exponential of x (e^x).
Definition math.h:270
void translate(double x, struct special *_special)
Definition math.h:377
double acos(double x)
Calculates the arccosine of x.
Definition math.h:217
int max(int a, int b)
Returns the larger of two integer values.
Definition math.h:421
double pow
Definition math.h:50
int sign
Definition math.h:48
int e
Definition math.h:51
double mantisa
Definition math.h:49