\[\frac{1 - \cos x}{x \cdot x}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;{x}^{-2} - {x}^{-2} \cdot \cos x\\
\mathbf{elif}\;x \leq 1.2754132945467591 \cdot 10^{-5}:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot \left(x \cdot x\right) + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan \left(\frac{x}{2}\right) \cdot \sin x}{x \cdot x}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
↓
(FPCore (x)
:precision binary64
(if (<= x -753.3516174146289)
(- (pow x -2.0) (* (pow x -2.0) (cos x)))
(if (<= x 1.2754132945467591e-5)
(+
0.5
(+
(* -0.041666666666666664 (* x x))
(* 0.001388888888888889 (pow x 4.0))))
(/ (* (tan (/ x 2.0)) (sin x)) (* x x)))))double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
double tmp;
if (x <= -753.3516174146289) {
tmp = pow(x, -2.0) - (pow(x, -2.0) * cos(x));
} else if (x <= 1.2754132945467591e-5) {
tmp = 0.5 + ((-0.041666666666666664 * (x * x)) + (0.001388888888888889 * pow(x, 4.0)));
} else {
tmp = (tan((x / 2.0)) * sin(x)) / (x * x);
}
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) :: tmp
if (x <= (-753.3516174146289d0)) then
tmp = (x ** (-2.0d0)) - ((x ** (-2.0d0)) * cos(x))
else if (x <= 1.2754132945467591d-5) then
tmp = 0.5d0 + (((-0.041666666666666664d0) * (x * x)) + (0.001388888888888889d0 * (x ** 4.0d0)))
else
tmp = (tan((x / 2.0d0)) * sin(x)) / (x * x)
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 tmp;
if (x <= -753.3516174146289) {
tmp = Math.pow(x, -2.0) - (Math.pow(x, -2.0) * Math.cos(x));
} else if (x <= 1.2754132945467591e-5) {
tmp = 0.5 + ((-0.041666666666666664 * (x * x)) + (0.001388888888888889 * Math.pow(x, 4.0)));
} else {
tmp = (Math.tan((x / 2.0)) * Math.sin(x)) / (x * x);
}
return tmp;
}
def code(x):
return (1.0 - math.cos(x)) / (x * x)
↓
def code(x):
tmp = 0
if x <= -753.3516174146289:
tmp = math.pow(x, -2.0) - (math.pow(x, -2.0) * math.cos(x))
elif x <= 1.2754132945467591e-5:
tmp = 0.5 + ((-0.041666666666666664 * (x * x)) + (0.001388888888888889 * math.pow(x, 4.0)))
else:
tmp = (math.tan((x / 2.0)) * math.sin(x)) / (x * x)
return tmp
function code(x)
return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
↓
function code(x)
tmp = 0.0
if (x <= -753.3516174146289)
tmp = Float64((x ^ -2.0) - Float64((x ^ -2.0) * cos(x)));
elseif (x <= 1.2754132945467591e-5)
tmp = Float64(0.5 + Float64(Float64(-0.041666666666666664 * Float64(x * x)) + Float64(0.001388888888888889 * (x ^ 4.0))));
else
tmp = Float64(Float64(tan(Float64(x / 2.0)) * sin(x)) / Float64(x * x));
end
return tmp
end
function tmp = code(x)
tmp = (1.0 - cos(x)) / (x * x);
end
↓
function tmp_2 = code(x)
tmp = 0.0;
if (x <= -753.3516174146289)
tmp = (x ^ -2.0) - ((x ^ -2.0) * cos(x));
elseif (x <= 1.2754132945467591e-5)
tmp = 0.5 + ((-0.041666666666666664 * (x * x)) + (0.001388888888888889 * (x ^ 4.0)));
else
tmp = (tan((x / 2.0)) * sin(x)) / (x * x);
end
tmp_2 = tmp;
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
↓
code[x_] := If[LessEqual[x, -753.3516174146289], N[(N[Power[x, -2.0], $MachinePrecision] - N[(N[Power[x, -2.0], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2754132945467591e-5], N[(0.5 + N[(N[(-0.041666666666666664 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(0.001388888888888889 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\frac{1 - \cos x}{x \cdot x}
↓
\begin{array}{l}
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;{x}^{-2} - {x}^{-2} \cdot \cos x\\
\mathbf{elif}\;x \leq 1.2754132945467591 \cdot 10^{-5}:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot \left(x \cdot x\right) + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan \left(\frac{x}{2}\right) \cdot \sin x}{x \cdot x}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.4 |
|---|
| Cost | 13640 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0038429952274706726:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot \left(x \cdot x\right) + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \left(\frac{x}{2}\right) \cdot \frac{\sin x}{x \cdot x}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.4 |
|---|
| Cost | 13640 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{elif}\;x \leq 1.2754132945467591 \cdot 10^{-5}:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot \left(x \cdot x\right) + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan \left(\frac{x}{2}\right) \cdot \sin x}{x \cdot x}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.4 |
|---|
| Cost | 7432 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0038429952274706726:\\
\;\;\;\;0.5 + \left(-0.041666666666666664 \cdot \left(x \cdot x\right) + 0.001388888888888889 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\frac{1}{x}}{x}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.5 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_0 := 1 - \cos x\\
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;\frac{\frac{t_0}{x}}{x}\\
\mathbf{elif}\;x \leq 0.0038429952274706726:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\frac{1}{x}}{x}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.4 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := \frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.0038429952274706726:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 13.3 |
|---|
| Cost | 832 |
|---|
\[\frac{1}{x \cdot \left(x \cdot 0.16666666666666666 + 2 \cdot \frac{1}{x}\right)}
\]
| Alternative 7 |
|---|
| Error | 14.9 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -753.3516174146289:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 0.0038429952274706726:\\
\;\;\;\;0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 14.8 |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -8.362066599189694 \cdot 10^{+88}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.596090494016065 \cdot 10^{+71}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 30.2 |
|---|
| Cost | 64 |
|---|
\[0.5
\]