# ?

Average Error: 36.4 → 12.0
Time: 29.7s
Precision: binary64
Cost: 235849

# ?

$\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}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Split input into 2 regimes
2. ## if (-.f64 (/.f64 (cos.f64 x) (sin.f64 x)) (/.f64 (cos.f64 (+.f64 x y)) (sin.f64 (+.f64 x y)))) < -0.5 or 1.9999999999999999e-7 < (-.f64 (/.f64 (cos.f64 x) (sin.f64 x)) (/.f64 (cos.f64 (+.f64 x y)) (sin.f64 (+.f64 x y))))

1. Initial program 16.8

$\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}$
2. Applied egg-rr17.4

$\leadsto \color{blue}{\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}\right)}^{2}}}$
3. Simplified17.4

$\leadsto \color{blue}{\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \left(y + x\right)}\right)}^{2}}}$
Proof
[Start]17.4 $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}\right)}^{2}}$ $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\tan \color{blue}{\left(y + x\right)}}\right)}^{2}}$
4. Applied egg-rr10.1

$\leadsto \sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\color{blue}{\left(\tan x + \tan y\right) \cdot \frac{1}{1 - \tan x \cdot \tan y}}}\right)}^{2}}$
5. Simplified10.1

$\leadsto \sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\color{blue}{\frac{\tan x + \tan y}{1 - \tan x \cdot \tan y}}}\right)}^{2}}$
Proof
[Start]10.1 $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\left(\tan x + \tan y\right) \cdot \frac{1}{1 - \tan x \cdot \tan y}}\right)}^{2}}$ $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\color{blue}{\frac{\tan x + \tan y}{1}} \cdot \frac{1}{1 - \tan x \cdot \tan y}}\right)}^{2}}$ $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\color{blue}{\frac{\tan x + \tan y}{\frac{1}{\frac{1}{1 - \tan x \cdot \tan y}}}}}\right)}^{2}}$ $\sqrt{{\left(\frac{1}{\tan x} + \frac{-1}{\frac{\tan x + \tan y}{\color{blue}{1 - \tan x \cdot \tan y}}}\right)}^{2}}$

## if -0.5 < (-.f64 (/.f64 (cos.f64 x) (sin.f64 x)) (/.f64 (cos.f64 (+.f64 x y)) (sin.f64 (+.f64 x y)))) < 1.9999999999999999e-7

1. Initial program 61.6

$\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)}$
2. Taylor expanded in y around 0 14.5

$\leadsto \color{blue}{\left(\left(-0.16666666666666666 \cdot \frac{{\cos x}^{2}}{{\sin x}^{2}} + \left(0.5 \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) + \frac{{\cos x}^{2} \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)}{{\sin x}^{2}}\right)\right) - 0.16666666666666666\right) \cdot {y}^{3} + \left(y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) + -1 \cdot \frac{\cos x \cdot \left({y}^{2} \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)\right)}{\sin x}\right)}$
3. Recombined 2 regimes into one program.
4. Final simplification12.0

$\leadsto \begin{array}{l} \mathbf{if}\;\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)} \leq -0.5 \lor \neg \left(\frac{\cos x}{\sin x} - \frac{\cos \left(x + y\right)}{\sin \left(x + y\right)} \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 \frac{{\cos x}^{2}}{{\sin x}^{2}} + \left(0.5 \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) + \frac{{\cos x}^{2} \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right)}{{\sin x}^{2}}\right)\right)\right) \cdot {y}^{3} + \left(y \cdot \left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) - \frac{\cos x \cdot \left(\left(1 + \frac{{\cos x}^{2}}{{\sin x}^{2}}\right) \cdot {y}^{2}\right)}{\sin x}\right)\\ \end{array}$

# Alternatives

Alternative 1
Error12.2
Cost124681
$\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
Error12.2
Cost112009
$\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
Error12.5
Cost98569
$\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
Error12.5
Cost98441
$\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
Error16.3
Cost92488
$\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
Error16.3
Cost85576
$\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
Error16.5
Cost85384
$\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
Error16.3
Cost78920
$\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
Error22.8
Cost26308
$\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
Error22.5
Cost26308
$\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
Error22.6
Cost26308
$\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
Error21.7
Cost20292
$\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
Error34.7
Cost20036
$\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
Error36.2
Cost19776
$\frac{\cos x}{\sin x} + \frac{-1}{\tan \left(x + y\right)}$
Alternative 15
Error36.4
Cost13376
$\frac{1}{\tan x} + \frac{-1}{\tan \left(x + y\right)}$
Alternative 16
Error39.1
Cost192
$\frac{1}{x}$

# Reproduce?

herbie shell --seed 1
(FPCore (x y)
:name "cos(x)/sin(x) - cos(x+y)/sin(x+y)"
:precision binary64
:pre (and (and (<= 1e-100 x) (<= x 1e+100)) (and (<= 1e-100 y) (<= y 1e+100)))
(- (/ (cos x) (sin x)) (/ (cos (+ x y)) (sin (+ x y)))))