\[\frac{1 - \cos x}{\sin x}
\]
↓
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{\sin x}\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;0.5 \cdot x + \left(0.041666666666666664 \cdot {x}^{3} + 0.004166666666666667 \cdot {x}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos x + -1}{\sin x \cdot \left(\sin x \cdot \frac{\sin x}{\sin x \cdot \sin \left(-x\right)}\right)}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (sin x)))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (/ (- 1.0 (cos x)) (sin x))))
(if (<= t_0 -0.02)
t_0
(if (<= t_0 0.0005)
(+
(* 0.5 x)
(+
(* 0.041666666666666664 (pow x 3.0))
(* 0.004166666666666667 (pow x 5.0))))
(/
(+ (cos x) -1.0)
(* (sin x) (* (sin x) (/ (sin x) (* (sin x) (sin (- x)))))))))))double code(double x) {
return (1.0 - cos(x)) / sin(x);
}
↓
double code(double x) {
double t_0 = (1.0 - cos(x)) / sin(x);
double tmp;
if (t_0 <= -0.02) {
tmp = t_0;
} else if (t_0 <= 0.0005) {
tmp = (0.5 * x) + ((0.041666666666666664 * pow(x, 3.0)) + (0.004166666666666667 * pow(x, 5.0)));
} else {
tmp = (cos(x) + -1.0) / (sin(x) * (sin(x) * (sin(x) / (sin(x) * sin(-x)))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / sin(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)) / sin(x)
if (t_0 <= (-0.02d0)) then
tmp = t_0
else if (t_0 <= 0.0005d0) then
tmp = (0.5d0 * x) + ((0.041666666666666664d0 * (x ** 3.0d0)) + (0.004166666666666667d0 * (x ** 5.0d0)))
else
tmp = (cos(x) + (-1.0d0)) / (sin(x) * (sin(x) * (sin(x) / (sin(x) * sin(-x)))))
end if
code = tmp
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / Math.sin(x);
}
↓
public static double code(double x) {
double t_0 = (1.0 - Math.cos(x)) / Math.sin(x);
double tmp;
if (t_0 <= -0.02) {
tmp = t_0;
} else if (t_0 <= 0.0005) {
tmp = (0.5 * x) + ((0.041666666666666664 * Math.pow(x, 3.0)) + (0.004166666666666667 * Math.pow(x, 5.0)));
} else {
tmp = (Math.cos(x) + -1.0) / (Math.sin(x) * (Math.sin(x) * (Math.sin(x) / (Math.sin(x) * Math.sin(-x)))));
}
return tmp;
}
def code(x):
return (1.0 - math.cos(x)) / math.sin(x)
↓
def code(x):
t_0 = (1.0 - math.cos(x)) / math.sin(x)
tmp = 0
if t_0 <= -0.02:
tmp = t_0
elif t_0 <= 0.0005:
tmp = (0.5 * x) + ((0.041666666666666664 * math.pow(x, 3.0)) + (0.004166666666666667 * math.pow(x, 5.0)))
else:
tmp = (math.cos(x) + -1.0) / (math.sin(x) * (math.sin(x) * (math.sin(x) / (math.sin(x) * math.sin(-x)))))
return tmp
function code(x)
return Float64(Float64(1.0 - cos(x)) / sin(x))
end
↓
function code(x)
t_0 = Float64(Float64(1.0 - cos(x)) / sin(x))
tmp = 0.0
if (t_0 <= -0.02)
tmp = t_0;
elseif (t_0 <= 0.0005)
tmp = Float64(Float64(0.5 * x) + Float64(Float64(0.041666666666666664 * (x ^ 3.0)) + Float64(0.004166666666666667 * (x ^ 5.0))));
else
tmp = Float64(Float64(cos(x) + -1.0) / Float64(sin(x) * Float64(sin(x) * Float64(sin(x) / Float64(sin(x) * sin(Float64(-x)))))));
end
return tmp
end
function tmp = code(x)
tmp = (1.0 - cos(x)) / sin(x);
end
↓
function tmp_2 = code(x)
t_0 = (1.0 - cos(x)) / sin(x);
tmp = 0.0;
if (t_0 <= -0.02)
tmp = t_0;
elseif (t_0 <= 0.0005)
tmp = (0.5 * x) + ((0.041666666666666664 * (x ^ 3.0)) + (0.004166666666666667 * (x ^ 5.0)));
else
tmp = (cos(x) + -1.0) / (sin(x) * (sin(x) * (sin(x) / (sin(x) * sin(-x)))));
end
tmp_2 = tmp;
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], t$95$0, If[LessEqual[t$95$0, 0.0005], N[(N[(0.5 * x), $MachinePrecision] + N[(N[(0.041666666666666664 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.004166666666666667 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[x], $MachinePrecision] + -1.0), $MachinePrecision] / N[(N[Sin[x], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] / N[(N[Sin[x], $MachinePrecision] * N[Sin[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{1 - \cos x}{\sin x}
↓
\begin{array}{l}
t_0 := \frac{1 - \cos x}{\sin x}\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;0.5 \cdot x + \left(0.041666666666666664 \cdot {x}^{3} + 0.004166666666666667 \cdot {x}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos x + -1}{\sin x \cdot \left(\sin x \cdot \frac{\sin x}{\sin x \cdot \sin \left(-x\right)}\right)}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.7 |
|---|
| Cost | 46280 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{\sin x}\\
t_1 := \frac{\cos x}{-2}\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;0.5 \cdot x + \left(0.041666666666666664 \cdot {x}^{3} + 0.004166666666666667 \cdot {x}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 + \left(t_1 + 1\right)}{\sin x}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.6 |
|---|
| Cost | 40008 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{\sin x}\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;0.5 \cdot x + \left(0.041666666666666664 \cdot {x}^{3} + 0.004166666666666667 \cdot {x}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.7 |
|---|
| Cost | 39496 |
|---|
\[\begin{array}{l}
t_0 := \frac{1 - \cos x}{\sin x}\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;0.5 \cdot x + 0.041666666666666664 \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 26.6 |
|---|
| Cost | 7176 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{\sin x} - \frac{1}{x}\\
\mathbf{if}\;x \leq -2.8:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.7:\\
\;\;\;\;0.5 \cdot x + 0.041666666666666664 \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 26.7 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{\sin x} - \frac{1}{x}\\
\mathbf{if}\;x \leq -2.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 42:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 61.7 |
|---|
| Cost | 192 |
|---|
\[-0.16666666666666666 \cdot x
\]
| Alternative 7 |
|---|
| Error | 31.8 |
|---|
| Cost | 192 |
|---|
\[0.5 \cdot x
\]