\[\frac{1 - \cos x}{x \cdot x}
\]
↓
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -2.6408359392783645:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot {x}^{2} + \left(-2.48015873015873 \cdot 10^{-5} \cdot {x}^{6} + 0.001388888888888889 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {x}^{-2}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (- 1.0 (cos x))))
(if (<= x -2.6408359392783645)
(/ (/ t_0 x) x)
(if (<= x 0.0007295408284379838)
(+
0.5
(+
(* -0.041666666666666664 (pow x 2.0))
(+
(* -2.48015873015873e-5 (pow x 6.0))
(* 0.001388888888888889 (pow x 4.0)))))
(* t_0 (pow x -2.0))))))double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
double t_0 = 1.0 - cos(x);
double tmp;
if (x <= -2.6408359392783645) {
tmp = (t_0 / x) / x;
} else if (x <= 0.0007295408284379838) {
tmp = 0.5 + ((-0.041666666666666664 * pow(x, 2.0)) + ((-2.48015873015873e-5 * pow(x, 6.0)) + (0.001388888888888889 * pow(x, 4.0))));
} else {
tmp = t_0 * pow(x, -2.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / (x * x)
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - cos(x)
if (x <= (-2.6408359392783645d0)) then
tmp = (t_0 / x) / x
else if (x <= 0.0007295408284379838d0) then
tmp = 0.5d0 + (((-0.041666666666666664d0) * (x ** 2.0d0)) + (((-2.48015873015873d-5) * (x ** 6.0d0)) + (0.001388888888888889d0 * (x ** 4.0d0))))
else
tmp = t_0 * (x ** (-2.0d0))
end if
code = tmp
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / (x * x);
}
↓
public static double code(double x) {
double t_0 = 1.0 - Math.cos(x);
double tmp;
if (x <= -2.6408359392783645) {
tmp = (t_0 / x) / x;
} else if (x <= 0.0007295408284379838) {
tmp = 0.5 + ((-0.041666666666666664 * Math.pow(x, 2.0)) + ((-2.48015873015873e-5 * Math.pow(x, 6.0)) + (0.001388888888888889 * Math.pow(x, 4.0))));
} else {
tmp = t_0 * Math.pow(x, -2.0);
}
return tmp;
}
def code(x):
return (1.0 - math.cos(x)) / (x * x)
↓
def code(x):
t_0 = 1.0 - math.cos(x)
tmp = 0
if x <= -2.6408359392783645:
tmp = (t_0 / x) / x
elif x <= 0.0007295408284379838:
tmp = 0.5 + ((-0.041666666666666664 * math.pow(x, 2.0)) + ((-2.48015873015873e-5 * math.pow(x, 6.0)) + (0.001388888888888889 * math.pow(x, 4.0))))
else:
tmp = t_0 * math.pow(x, -2.0)
return tmp
function code(x)
return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
↓
function code(x)
t_0 = Float64(1.0 - cos(x))
tmp = 0.0
if (x <= -2.6408359392783645)
tmp = Float64(Float64(t_0 / x) / x);
elseif (x <= 0.0007295408284379838)
tmp = Float64(0.5 + Float64(Float64(-0.041666666666666664 * (x ^ 2.0)) + Float64(Float64(-2.48015873015873e-5 * (x ^ 6.0)) + Float64(0.001388888888888889 * (x ^ 4.0)))));
else
tmp = Float64(t_0 * (x ^ -2.0));
end
return tmp
end
function tmp = code(x)
tmp = (1.0 - cos(x)) / (x * x);
end
↓
function tmp_2 = code(x)
t_0 = 1.0 - cos(x);
tmp = 0.0;
if (x <= -2.6408359392783645)
tmp = (t_0 / x) / x;
elseif (x <= 0.0007295408284379838)
tmp = 0.5 + ((-0.041666666666666664 * (x ^ 2.0)) + ((-2.48015873015873e-5 * (x ^ 6.0)) + (0.001388888888888889 * (x ^ 4.0))));
else
tmp = t_0 * (x ^ -2.0);
end
tmp_2 = tmp;
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6408359392783645], N[(N[(t$95$0 / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.0007295408284379838], N[(0.5 + N[(N[(-0.041666666666666664 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-2.48015873015873e-5 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(0.001388888888888889 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]]]]
\frac{1 - \cos x}{x \cdot x}
↓
\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -2.6408359392783645:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot {x}^{2} + \left(-2.48015873015873 \cdot 10^{-5} \cdot {x}^{6} + 0.001388888888888889 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {x}^{-2}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.3 |
|---|
| Cost | 13768 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.049718773505307026:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot {x}^{2} + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {x}^{-2}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.3 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.049718773505307026:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;\frac{\frac{1}{x}}{0.008333333333333333 \cdot {x}^{3} + \left(x \cdot 0.16666666666666666 + 2 \cdot \frac{1}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {x}^{-2}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.3 |
|---|
| Cost | 7816 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{x}\\
\mathbf{if}\;x \leq -0.049718773505307026:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;\frac{\frac{1}{x}}{0.008333333333333333 \cdot {x}^{3} + \left(x \cdot 0.16666666666666666 + 2 \cdot \frac{1}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{x}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.3 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{x}\\
\mathbf{if}\;x \leq -0.049718773505307026:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{x}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.3 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := \frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{if}\;x \leq -0.049718773505307026:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 13.9 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
t_0 := \frac{6}{x \cdot x}\\
\mathbf{if}\;x \leq -11469.135466714282:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 14.0 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
t_0 := \frac{6}{x \cdot x}\\
\mathbf{if}\;x \leq -11469.135466714282:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.0007295408284379838:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 13.8 |
|---|
| Cost | 576 |
|---|
\[\frac{-0.25}{-0.041666666666666664 \cdot \left(x \cdot x\right) + -0.5}
\]
| Alternative 9 |
|---|
| Error | 15.4 |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.2835276102229484 \cdot 10^{+78}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.5121850658158162 \cdot 10^{+59}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 31.0 |
|---|
| Cost | 64 |
|---|
\[0.5
\]