\[\left(10^{-100} \leq x \land x \leq 10^{+100}\right) \land \left(10^{-100} \leq y \land y \leq 10^{+100}\right)\]
\[\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}
\]
↓
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
t_1 := {\cos x}^{2}\\
t_2 := {\sin x}^{2}\\
t_3 := \frac{t_1}{t_2}\\
t_4 := 1 + t_3\\
\mathbf{if}\;t_0 \leq -0.5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(-0.16666666666666666 + \left(-0.16666666666666666 \cdot t_3 + \left(0.5 \cdot t_4 + \frac{t_1 \cdot t_4}{t_2}\right)\right)\right) \cdot {y}^{3} + \left(y \cdot t_4 - \frac{\cos x \cdot \left(t_4 \cdot {y}^{2}\right)}{\sin x}\right)\\
\end{array}
\]
(FPCore (x y)
:precision binary64
(- (/ (cos x) (sin x)) (/ (cos (+ x y)) (sin (+ x y)))))
↓
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ (cos x) (sin x)) (/ (cos (+ x y)) (sin (+ x y)))))
(t_1 (pow (cos x) 2.0))
(t_2 (pow (sin x) 2.0))
(t_3 (/ t_1 t_2))
(t_4 (+ 1.0 t_3)))
(if (or (<= t_0 -0.5) (not (<= t_0 2e-7)))
(sqrt
(pow
(+
(/ 1.0 (tan x))
(/ -1.0 (/ (+ (tan x) (tan y)) (- 1.0 (* (tan x) (tan y))))))
2.0))
(+
(*
(+
-0.16666666666666666
(+ (* -0.16666666666666666 t_3) (+ (* 0.5 t_4) (/ (* t_1 t_4) t_2))))
(pow y 3.0))
(- (* y t_4) (/ (* (cos x) (* t_4 (pow y 2.0))) (sin x)))))))
double code(double x, double y) {
return (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)));
}
↓
double code(double x, double y) {
double t_0 = (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)));
double t_1 = pow(cos(x), 2.0);
double t_2 = pow(sin(x), 2.0);
double t_3 = t_1 / t_2;
double t_4 = 1.0 + t_3;
double tmp;
if ((t_0 <= -0.5) || !(t_0 <= 2e-7)) {
tmp = sqrt(pow(((1.0 / tan(x)) + (-1.0 / ((tan(x) + tan(y)) / (1.0 - (tan(x) * tan(y)))))), 2.0));
} else {
tmp = ((-0.16666666666666666 + ((-0.16666666666666666 * t_3) + ((0.5 * t_4) + ((t_1 * t_4) / t_2)))) * pow(y, 3.0)) + ((y * t_4) - ((cos(x) * (t_4 * pow(y, 2.0))) / sin(x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)))
end function
↓
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)))
t_1 = cos(x) ** 2.0d0
t_2 = sin(x) ** 2.0d0
t_3 = t_1 / t_2
t_4 = 1.0d0 + t_3
if ((t_0 <= (-0.5d0)) .or. (.not. (t_0 <= 2d-7))) then
tmp = sqrt((((1.0d0 / tan(x)) + ((-1.0d0) / ((tan(x) + tan(y)) / (1.0d0 - (tan(x) * tan(y)))))) ** 2.0d0))
else
tmp = (((-0.16666666666666666d0) + (((-0.16666666666666666d0) * t_3) + ((0.5d0 * t_4) + ((t_1 * t_4) / t_2)))) * (y ** 3.0d0)) + ((y * t_4) - ((cos(x) * (t_4 * (y ** 2.0d0))) / sin(x)))
end if
code = tmp
end function
public static double code(double x, double y) {
return (Math.cos(x) / Math.sin(x)) - (Math.cos((x + y)) / Math.sin((x + y)));
}
↓
public static double code(double x, double y) {
double t_0 = (Math.cos(x) / Math.sin(x)) - (Math.cos((x + y)) / Math.sin((x + y)));
double t_1 = Math.pow(Math.cos(x), 2.0);
double t_2 = Math.pow(Math.sin(x), 2.0);
double t_3 = t_1 / t_2;
double t_4 = 1.0 + t_3;
double tmp;
if ((t_0 <= -0.5) || !(t_0 <= 2e-7)) {
tmp = Math.sqrt(Math.pow(((1.0 / Math.tan(x)) + (-1.0 / ((Math.tan(x) + Math.tan(y)) / (1.0 - (Math.tan(x) * Math.tan(y)))))), 2.0));
} else {
tmp = ((-0.16666666666666666 + ((-0.16666666666666666 * t_3) + ((0.5 * t_4) + ((t_1 * t_4) / t_2)))) * Math.pow(y, 3.0)) + ((y * t_4) - ((Math.cos(x) * (t_4 * Math.pow(y, 2.0))) / Math.sin(x)));
}
return tmp;
}
def code(x, y):
return (math.cos(x) / math.sin(x)) - (math.cos((x + y)) / math.sin((x + y)))
↓
def code(x, y):
t_0 = (math.cos(x) / math.sin(x)) - (math.cos((x + y)) / math.sin((x + y)))
t_1 = math.pow(math.cos(x), 2.0)
t_2 = math.pow(math.sin(x), 2.0)
t_3 = t_1 / t_2
t_4 = 1.0 + t_3
tmp = 0
if (t_0 <= -0.5) or not (t_0 <= 2e-7):
tmp = math.sqrt(math.pow(((1.0 / math.tan(x)) + (-1.0 / ((math.tan(x) + math.tan(y)) / (1.0 - (math.tan(x) * math.tan(y)))))), 2.0))
else:
tmp = ((-0.16666666666666666 + ((-0.16666666666666666 * t_3) + ((0.5 * t_4) + ((t_1 * t_4) / t_2)))) * math.pow(y, 3.0)) + ((y * t_4) - ((math.cos(x) * (t_4 * math.pow(y, 2.0))) / math.sin(x)))
return tmp
function code(x, y)
return Float64(Float64(cos(x) / sin(x)) - Float64(cos(Float64(x + y)) / sin(Float64(x + y))))
end
↓
function code(x, y)
t_0 = Float64(Float64(cos(x) / sin(x)) - Float64(cos(Float64(x + y)) / sin(Float64(x + y))))
t_1 = cos(x) ^ 2.0
t_2 = sin(x) ^ 2.0
t_3 = Float64(t_1 / t_2)
t_4 = Float64(1.0 + t_3)
tmp = 0.0
if ((t_0 <= -0.5) || !(t_0 <= 2e-7))
tmp = sqrt((Float64(Float64(1.0 / tan(x)) + Float64(-1.0 / Float64(Float64(tan(x) + tan(y)) / Float64(1.0 - Float64(tan(x) * tan(y)))))) ^ 2.0));
else
tmp = Float64(Float64(Float64(-0.16666666666666666 + Float64(Float64(-0.16666666666666666 * t_3) + Float64(Float64(0.5 * t_4) + Float64(Float64(t_1 * t_4) / t_2)))) * (y ^ 3.0)) + Float64(Float64(y * t_4) - Float64(Float64(cos(x) * Float64(t_4 * (y ^ 2.0))) / sin(x))));
end
return tmp
end
function tmp = code(x, y)
tmp = (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)));
end
↓
function tmp_2 = code(x, y)
t_0 = (cos(x) / sin(x)) - (cos((x + y)) / sin((x + y)));
t_1 = cos(x) ^ 2.0;
t_2 = sin(x) ^ 2.0;
t_3 = t_1 / t_2;
t_4 = 1.0 + t_3;
tmp = 0.0;
if ((t_0 <= -0.5) || ~((t_0 <= 2e-7)))
tmp = sqrt((((1.0 / tan(x)) + (-1.0 / ((tan(x) + tan(y)) / (1.0 - (tan(x) * tan(y)))))) ^ 2.0));
else
tmp = ((-0.16666666666666666 + ((-0.16666666666666666 * t_3) + ((0.5 * t_4) + ((t_1 * t_4) / t_2)))) * (y ^ 3.0)) + ((y * t_4) - ((cos(x) * (t_4 * (y ^ 2.0))) / sin(x)));
end
tmp_2 = tmp;
end
code[x_, y_] := N[(N[(N[Cos[x], $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(x + y), $MachinePrecision]], $MachinePrecision] / N[Sin[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Cos[x], $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(x + y), $MachinePrecision]], $MachinePrecision] / N[Sin[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + t$95$3), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.5], N[Not[LessEqual[t$95$0, 2e-7]], $MachinePrecision]], N[Sqrt[N[Power[N[(N[(1.0 / N[Tan[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], N[(N[(N[(-0.16666666666666666 + N[(N[(-0.16666666666666666 * t$95$3), $MachinePrecision] + N[(N[(0.5 * t$95$4), $MachinePrecision] + N[(N[(t$95$1 * t$95$4), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(y * t$95$4), $MachinePrecision] - N[(N[(N[Cos[x], $MachinePrecision] * N[(t$95$4 * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}
↓
\begin{array}{l}
t_0 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
t_1 := {\cos x}^{2}\\
t_2 := {\sin x}^{2}\\
t_3 := \frac{t_1}{t_2}\\
t_4 := 1 + t_3\\
\mathbf{if}\;t_0 \leq -0.5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(-0.16666666666666666 + \left(-0.16666666666666666 \cdot t_3 + \left(0.5 \cdot t_4 + \frac{t_1 \cdot t_4}{t_2}\right)\right)\right) \cdot {y}^{3} + \left(y \cdot t_4 - \frac{\cos x \cdot \left(t_4 \cdot {y}^{2}\right)}{\sin x}\right)\\
\end{array}
Alternatives
Alternative 1 |
---|
Error | 12.2 |
---|
Cost | 124681 |
---|
\[\begin{array}{l}
t_0 := 1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\\
t_1 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_1 \leq -0.5 \lor \neg \left(t_1 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t_0, \frac{-\cos x}{\frac{\frac{\sin x}{y \cdot y}}{t_0}}\right)\\
\end{array}
\]
Alternative 2 |
---|
Error | 12.2 |
---|
Cost | 112009 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x}\\
t_1 := t_0 - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_1 \leq -0.5 \lor \neg \left(t_1 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) - \frac{\cos x \cdot \left(y \cdot y + y \cdot \left(y \cdot {t_0}^{2}\right)\right)}{\sin x}\\
\end{array}
\]
Alternative 3 |
---|
Error | 12.5 |
---|
Cost | 98569 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_0 \leq -0.5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) - \frac{\cos x \cdot \frac{y \cdot y}{x \cdot x}}{\sin x}\\
\end{array}
\]
Alternative 4 |
---|
Error | 12.5 |
---|
Cost | 98441 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_0 \leq -0.5 \lor \neg \left(t_0 \leq 2 \cdot 10^{-7}\right):\\
\;\;\;\;\sqrt{{\left(\frac{1}{\tan x} + \frac{-1 + \tan x \cdot \tan y}{\tan x + \tan y}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) - \frac{\cos x \cdot \frac{y \cdot y}{x \cdot x}}{\sin x}\\
\end{array}
\]
Alternative 5 |
---|
Error | 16.3 |
---|
Cost | 92488 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x}\\
t_1 := \cos \left(x + y\right)\\
t_2 := t_0 - \frac{t_1}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_2 \leq -0.5:\\
\;\;\;\;\sqrt[3]{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}\right)}^{3}}\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) - \frac{\cos x \cdot \frac{y \cdot y}{x \cdot x}}{\sin x}\\
\mathbf{else}:\\
\;\;\;\;t_0 - \frac{t_1}{\sin y + x \cdot \cos y}\\
\end{array}
\]
Alternative 6 |
---|
Error | 16.3 |
---|
Cost | 85576 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x}\\
t_1 := \cos \left(x + y\right)\\
t_2 := t_0 - \frac{t_1}{\sin \left(x + y\right)}\\
\mathbf{if}\;t_2 \leq -0.5:\\
\;\;\;\;\sqrt[3]{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}\right)}^{3}}\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - \frac{t_1}{\sin y + x \cdot \cos y}\\
\end{array}
\]
Alternative 7 |
---|
Error | 16.5 |
---|
Cost | 85384 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x}\\
t_1 := t_0 - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
t_2 := \tan \left(x + y\right)\\
\mathbf{if}\;t_1 \leq -0.5:\\
\;\;\;\;\sqrt[3]{{\left(\frac{1}{\tan x} + \frac{-1}{t_2}\right)}^{3}}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - \sqrt{{\left(\frac{1}{t_2}\right)}^{2}}\\
\end{array}
\]
Alternative 8 |
---|
Error | 16.3 |
---|
Cost | 78920 |
---|
\[\begin{array}{l}
t_0 := \frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}\\
t_1 := \frac{-1}{\tan \left(x + y\right)}\\
\mathbf{if}\;t_0 \leq -0.5:\\
\;\;\;\;\sqrt[3]{{\left(\frac{1}{\tan x} + t_1\right)}^{3}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos x, \frac{1}{\sin x}, t_1\right)\\
\end{array}
\]
Alternative 9 |
---|
Error | 22.8 |
---|
Cost | 26308 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos x}{\sin x} + \frac{-1}{\tan \left(x + y\right)}\\
\end{array}
\]
Alternative 10 |
---|
Error | 22.5 |
---|
Cost | 26308 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos x}{\sin x} - \frac{\cos y}{\sin \left(x + y\right)}\\
\end{array}
\]
Alternative 11 |
---|
Error | 22.6 |
---|
Cost | 26308 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos x, \frac{1}{\sin x}, \frac{-1}{\tan \left(x + y\right)}\right)\\
\end{array}
\]
Alternative 12 |
---|
Error | 21.7 |
---|
Cost | 20292 |
---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin y}{\frac{\cos \left(\left(x - x\right) - y\right) - \cos \left(y + \left(x + x\right)\right)}{2}}\\
\end{array}
\]
Alternative 13 |
---|
Error | 34.7 |
---|
Cost | 20036 |
---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{\cos x}{\sin x} + \frac{-1}{\tan \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} + \frac{\sin x}{\frac{\sin \left(x + y\right)}{\sin y}}\\
\end{array}
\]
Alternative 14 |
---|
Error | 36.2 |
---|
Cost | 19776 |
---|
\[\frac{\cos x}{\sin x} + \frac{-1}{\tan \left(x + y\right)}
\]
Alternative 15 |
---|
Error | 36.4 |
---|
Cost | 13376 |
---|
\[\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}
\]
Alternative 16 |
---|
Error | 39.1 |
---|
Cost | 192 |
---|
\[\frac{1}{x}
\]