\[\frac{1 - \cos x}{x \cdot x}
\]
↓
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\begin{array}{l}
\mathbf{if}\;2 \ne 0:\\
\;\;\;\;\sin x \cdot \tan \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}}{x \cdot x}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-42}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\begin{array}{l}
\mathbf{if}\;2 \ne 0:\\
\;\;\;\;\sin x \cdot \tan \left(\frac{x}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}}{x}}{x}\\
\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 -2e-5)
(/ (if (!= 2.0 0.0) (* (sin x) (tan (* x 0.5))) t_0) (* x x))
(if (<= x 4e-42)
0.5
(/ (/ (if (!= 2.0 0.0) (* (sin x) (tan (/ x 2.0))) t_0) x) x)))))double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
double t_0 = 1.0 - cos(x);
double tmp_1;
if (x <= -2e-5) {
double tmp_2;
if (2.0 != 0.0) {
tmp_2 = sin(x) * tan((x * 0.5));
} else {
tmp_2 = t_0;
}
tmp_1 = tmp_2 / (x * x);
} else if (x <= 4e-42) {
tmp_1 = 0.5;
} else {
double tmp_3;
if (2.0 != 0.0) {
tmp_3 = sin(x) * tan((x / 2.0));
} else {
tmp_3 = t_0;
}
tmp_1 = (tmp_3 / x) / x;
}
return tmp_1;
}
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
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = 1.0d0 - cos(x)
if (x <= (-2d-5)) then
if (2.0d0 /= 0.0d0) then
tmp_2 = sin(x) * tan((x * 0.5d0))
else
tmp_2 = t_0
end if
tmp_1 = tmp_2 / (x * x)
else if (x <= 4d-42) then
tmp_1 = 0.5d0
else
if (2.0d0 /= 0.0d0) then
tmp_3 = sin(x) * tan((x / 2.0d0))
else
tmp_3 = t_0
end if
tmp_1 = (tmp_3 / x) / x
end if
code = tmp_1
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_1;
if (x <= -2e-5) {
double tmp_2;
if (2.0 != 0.0) {
tmp_2 = Math.sin(x) * Math.tan((x * 0.5));
} else {
tmp_2 = t_0;
}
tmp_1 = tmp_2 / (x * x);
} else if (x <= 4e-42) {
tmp_1 = 0.5;
} else {
double tmp_3;
if (2.0 != 0.0) {
tmp_3 = Math.sin(x) * Math.tan((x / 2.0));
} else {
tmp_3 = t_0;
}
tmp_1 = (tmp_3 / x) / x;
}
return tmp_1;
}
def code(x):
return (1.0 - math.cos(x)) / (x * x)
↓
def code(x):
t_0 = 1.0 - math.cos(x)
tmp_1 = 0
if x <= -2e-5:
tmp_2 = 0
if 2.0 != 0.0:
tmp_2 = math.sin(x) * math.tan((x * 0.5))
else:
tmp_2 = t_0
tmp_1 = tmp_2 / (x * x)
elif x <= 4e-42:
tmp_1 = 0.5
else:
tmp_3 = 0
if 2.0 != 0.0:
tmp_3 = math.sin(x) * math.tan((x / 2.0))
else:
tmp_3 = t_0
tmp_1 = (tmp_3 / x) / x
return tmp_1
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_1 = 0.0
if (x <= -2e-5)
tmp_2 = 0.0
if (2.0 != 0.0)
tmp_2 = Float64(sin(x) * tan(Float64(x * 0.5)));
else
tmp_2 = t_0;
end
tmp_1 = Float64(tmp_2 / Float64(x * x));
elseif (x <= 4e-42)
tmp_1 = 0.5;
else
tmp_3 = 0.0
if (2.0 != 0.0)
tmp_3 = Float64(sin(x) * tan(Float64(x / 2.0)));
else
tmp_3 = t_0;
end
tmp_1 = Float64(Float64(tmp_3 / x) / x);
end
return tmp_1
end
function tmp = code(x)
tmp = (1.0 - cos(x)) / (x * x);
end
↓
function tmp_5 = code(x)
t_0 = 1.0 - cos(x);
tmp_2 = 0.0;
if (x <= -2e-5)
tmp_3 = 0.0;
if (2.0 ~= 0.0)
tmp_3 = sin(x) * tan((x * 0.5));
else
tmp_3 = t_0;
end
tmp_2 = tmp_3 / (x * x);
elseif (x <= 4e-42)
tmp_2 = 0.5;
else
tmp_4 = 0.0;
if (2.0 ~= 0.0)
tmp_4 = sin(x) * tan((x / 2.0));
else
tmp_4 = t_0;
end
tmp_2 = (tmp_4 / x) / x;
end
tmp_5 = tmp_2;
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, -2e-5], N[(If[Unequal[2.0, 0.0], N[(N[Sin[x], $MachinePrecision] * N[Tan[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0] / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e-42], 0.5, N[(N[(If[Unequal[2.0, 0.0], N[(N[Sin[x], $MachinePrecision] * N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0] / x), $MachinePrecision] / x), $MachinePrecision]]]]
\frac{1 - \cos x}{x \cdot x}
↓
\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\begin{array}{l}
\mathbf{if}\;2 \ne 0:\\
\;\;\;\;\sin x \cdot \tan \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}}{x \cdot x}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-42}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\begin{array}{l}
\mathbf{if}\;2 \ne 0:\\
\;\;\;\;\sin x \cdot \tan \left(\frac{x}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}}{x}}{x}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 13772 |
|---|
\[\begin{array}{l}
t_0 := \frac{\frac{\begin{array}{l}
\mathbf{if}\;2 \ne 0:\\
\;\;\;\;\sin x \cdot \tan \left(\frac{x}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \cos x\\
\end{array}}{x}}{x}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-42}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.4 |
|---|
| Cost | 7496 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.0047:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;0.5 \cdot \left(x \cdot x\right) \ne 0:\\
\;\;\;\;\frac{-1}{\frac{x \cdot x}{\cos x + -1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x \cdot x}\\
\end{array}\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{x} \cdot t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.4 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.0047:\\
\;\;\;\;\frac{t_0}{x \cdot x}\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{x} \cdot \frac{1}{x}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.4 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.0047:\\
\;\;\;\;\frac{t_0}{x \cdot x}\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{x} \cdot t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.6 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{x \cdot x}\\
\mathbf{if}\;x \leq -0.0047:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.4 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -0.0047:\\
\;\;\;\;\frac{t_0}{x \cdot x}\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 15.7 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{x \cdot x} - \frac{\frac{1}{x}}{x}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+60}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 15.7 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5 \cdot x}{x \cdot x} \cdot x\\
\mathbf{if}\;x \leq -3.2:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.2:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 15.7 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_0 := \frac{\frac{1}{x} - \frac{1}{x}}{x}\\
\mathbf{if}\;x \leq -6.8 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+77}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 31.0 |
|---|
| Cost | 64 |
|---|
\[0.5
\]