?

Average Error: 36.9 → 14.2
Time: 38.0s
Precision: binary64
Cost: 347592

?

\[\tan \left(x + \varepsilon\right) - \tan x \]
\[\begin{array}{l} t_0 := {\cos x}^{2}\\ t_1 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ t_2 := \tan \left(x + \varepsilon\right)\\ t_3 := {\sin x}^{2}\\ t_4 := -\frac{t_3}{t_0}\\ t_5 := 1 - t_4\\ t_6 := t_5 \cdot t_4 + \left(-0.5 \cdot t_5 + \left(0.16666666666666666 + t_3 \cdot \frac{0.16666666666666666}{t_0}\right)\right)\\ \mathbf{if}\;\varepsilon \leq -0.0195:\\ \;\;\;\;\left(\frac{t_1}{2} - \left(t_2 + \tan x\right)\right) + \left(\frac{t_2}{2} - \left(-t_2\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\left(\varepsilon \cdot t_5 + \frac{t_5 \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot t_6 + \left(\frac{\sin x \cdot t_6}{\cos x} + \frac{\sin x \cdot t_5}{\cos x} \cdot -0.3333333333333333\right) \cdot {\varepsilon}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (pow (cos x) 2.0))
        (t_1 (/ (sin eps) (cos eps)))
        (t_2 (tan (+ x eps)))
        (t_3 (pow (sin x) 2.0))
        (t_4 (- (/ t_3 t_0)))
        (t_5 (- 1.0 t_4))
        (t_6
         (+
          (* t_5 t_4)
          (+
           (* -0.5 t_5)
           (+ 0.16666666666666666 (* t_3 (/ 0.16666666666666666 t_0)))))))
   (if (<= eps -0.0195)
     (+ (- (/ t_1 2.0) (+ t_2 (tan x))) (- (/ t_2 2.0) (- t_2)))
     (if (<= eps 2.3e-6)
       (+
        (+ (* eps t_5) (/ (* t_5 (* (sin x) (pow eps 2.0))) (cos x)))
        (*
         -1.0
         (+
          (* (pow eps 3.0) t_6)
          (*
           (+
            (/ (* (sin x) t_6) (cos x))
            (* (/ (* (sin x) t_5) (cos x)) -0.3333333333333333))
           (pow eps 4.0)))))
       t_1))))
double code(double x, double eps) {
	return tan((x + eps)) - tan(x);
}
double code(double x, double eps) {
	double t_0 = pow(cos(x), 2.0);
	double t_1 = sin(eps) / cos(eps);
	double t_2 = tan((x + eps));
	double t_3 = pow(sin(x), 2.0);
	double t_4 = -(t_3 / t_0);
	double t_5 = 1.0 - t_4;
	double t_6 = (t_5 * t_4) + ((-0.5 * t_5) + (0.16666666666666666 + (t_3 * (0.16666666666666666 / t_0))));
	double tmp;
	if (eps <= -0.0195) {
		tmp = ((t_1 / 2.0) - (t_2 + tan(x))) + ((t_2 / 2.0) - -t_2);
	} else if (eps <= 2.3e-6) {
		tmp = ((eps * t_5) + ((t_5 * (sin(x) * pow(eps, 2.0))) / cos(x))) + (-1.0 * ((pow(eps, 3.0) * t_6) + ((((sin(x) * t_6) / cos(x)) + (((sin(x) * t_5) / cos(x)) * -0.3333333333333333)) * pow(eps, 4.0))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = tan((x + eps)) - tan(x)
end function
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_0 = cos(x) ** 2.0d0
    t_1 = sin(eps) / cos(eps)
    t_2 = tan((x + eps))
    t_3 = sin(x) ** 2.0d0
    t_4 = -(t_3 / t_0)
    t_5 = 1.0d0 - t_4
    t_6 = (t_5 * t_4) + (((-0.5d0) * t_5) + (0.16666666666666666d0 + (t_3 * (0.16666666666666666d0 / t_0))))
    if (eps <= (-0.0195d0)) then
        tmp = ((t_1 / 2.0d0) - (t_2 + tan(x))) + ((t_2 / 2.0d0) - -t_2)
    else if (eps <= 2.3d-6) then
        tmp = ((eps * t_5) + ((t_5 * (sin(x) * (eps ** 2.0d0))) / cos(x))) + ((-1.0d0) * (((eps ** 3.0d0) * t_6) + ((((sin(x) * t_6) / cos(x)) + (((sin(x) * t_5) / cos(x)) * (-0.3333333333333333d0))) * (eps ** 4.0d0))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	return Math.tan((x + eps)) - Math.tan(x);
}
public static double code(double x, double eps) {
	double t_0 = Math.pow(Math.cos(x), 2.0);
	double t_1 = Math.sin(eps) / Math.cos(eps);
	double t_2 = Math.tan((x + eps));
	double t_3 = Math.pow(Math.sin(x), 2.0);
	double t_4 = -(t_3 / t_0);
	double t_5 = 1.0 - t_4;
	double t_6 = (t_5 * t_4) + ((-0.5 * t_5) + (0.16666666666666666 + (t_3 * (0.16666666666666666 / t_0))));
	double tmp;
	if (eps <= -0.0195) {
		tmp = ((t_1 / 2.0) - (t_2 + Math.tan(x))) + ((t_2 / 2.0) - -t_2);
	} else if (eps <= 2.3e-6) {
		tmp = ((eps * t_5) + ((t_5 * (Math.sin(x) * Math.pow(eps, 2.0))) / Math.cos(x))) + (-1.0 * ((Math.pow(eps, 3.0) * t_6) + ((((Math.sin(x) * t_6) / Math.cos(x)) + (((Math.sin(x) * t_5) / Math.cos(x)) * -0.3333333333333333)) * Math.pow(eps, 4.0))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, eps):
	return math.tan((x + eps)) - math.tan(x)
def code(x, eps):
	t_0 = math.pow(math.cos(x), 2.0)
	t_1 = math.sin(eps) / math.cos(eps)
	t_2 = math.tan((x + eps))
	t_3 = math.pow(math.sin(x), 2.0)
	t_4 = -(t_3 / t_0)
	t_5 = 1.0 - t_4
	t_6 = (t_5 * t_4) + ((-0.5 * t_5) + (0.16666666666666666 + (t_3 * (0.16666666666666666 / t_0))))
	tmp = 0
	if eps <= -0.0195:
		tmp = ((t_1 / 2.0) - (t_2 + math.tan(x))) + ((t_2 / 2.0) - -t_2)
	elif eps <= 2.3e-6:
		tmp = ((eps * t_5) + ((t_5 * (math.sin(x) * math.pow(eps, 2.0))) / math.cos(x))) + (-1.0 * ((math.pow(eps, 3.0) * t_6) + ((((math.sin(x) * t_6) / math.cos(x)) + (((math.sin(x) * t_5) / math.cos(x)) * -0.3333333333333333)) * math.pow(eps, 4.0))))
	else:
		tmp = t_1
	return tmp
function code(x, eps)
	return Float64(tan(Float64(x + eps)) - tan(x))
end
function code(x, eps)
	t_0 = cos(x) ^ 2.0
	t_1 = Float64(sin(eps) / cos(eps))
	t_2 = tan(Float64(x + eps))
	t_3 = sin(x) ^ 2.0
	t_4 = Float64(-Float64(t_3 / t_0))
	t_5 = Float64(1.0 - t_4)
	t_6 = Float64(Float64(t_5 * t_4) + Float64(Float64(-0.5 * t_5) + Float64(0.16666666666666666 + Float64(t_3 * Float64(0.16666666666666666 / t_0)))))
	tmp = 0.0
	if (eps <= -0.0195)
		tmp = Float64(Float64(Float64(t_1 / 2.0) - Float64(t_2 + tan(x))) + Float64(Float64(t_2 / 2.0) - Float64(-t_2)));
	elseif (eps <= 2.3e-6)
		tmp = Float64(Float64(Float64(eps * t_5) + Float64(Float64(t_5 * Float64(sin(x) * (eps ^ 2.0))) / cos(x))) + Float64(-1.0 * Float64(Float64((eps ^ 3.0) * t_6) + Float64(Float64(Float64(Float64(sin(x) * t_6) / cos(x)) + Float64(Float64(Float64(sin(x) * t_5) / cos(x)) * -0.3333333333333333)) * (eps ^ 4.0)))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp = code(x, eps)
	tmp = tan((x + eps)) - tan(x);
end
function tmp_2 = code(x, eps)
	t_0 = cos(x) ^ 2.0;
	t_1 = sin(eps) / cos(eps);
	t_2 = tan((x + eps));
	t_3 = sin(x) ^ 2.0;
	t_4 = -(t_3 / t_0);
	t_5 = 1.0 - t_4;
	t_6 = (t_5 * t_4) + ((-0.5 * t_5) + (0.16666666666666666 + (t_3 * (0.16666666666666666 / t_0))));
	tmp = 0.0;
	if (eps <= -0.0195)
		tmp = ((t_1 / 2.0) - (t_2 + tan(x))) + ((t_2 / 2.0) - -t_2);
	elseif (eps <= 2.3e-6)
		tmp = ((eps * t_5) + ((t_5 * (sin(x) * (eps ^ 2.0))) / cos(x))) + (-1.0 * (((eps ^ 3.0) * t_6) + ((((sin(x) * t_6) / cos(x)) + (((sin(x) * t_5) / cos(x)) * -0.3333333333333333)) * (eps ^ 4.0))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = (-N[(t$95$3 / t$95$0), $MachinePrecision])}, Block[{t$95$5 = N[(1.0 - t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$5 * t$95$4), $MachinePrecision] + N[(N[(-0.5 * t$95$5), $MachinePrecision] + N[(0.16666666666666666 + N[(t$95$3 * N[(0.16666666666666666 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -0.0195], N[(N[(N[(t$95$1 / 2.0), $MachinePrecision] - N[(t$95$2 + N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 / 2.0), $MachinePrecision] - (-t$95$2)), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 2.3e-6], N[(N[(N[(eps * t$95$5), $MachinePrecision] + N[(N[(t$95$5 * N[(N[Sin[x], $MachinePrecision] * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(N[(N[Power[eps, 3.0], $MachinePrecision] * t$95$6), $MachinePrecision] + N[(N[(N[(N[(N[Sin[x], $MachinePrecision] * t$95$6), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Sin[x], $MachinePrecision] * t$95$5), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]]
\tan \left(x + \varepsilon\right) - \tan x
\begin{array}{l}
t_0 := {\cos x}^{2}\\
t_1 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
t_2 := \tan \left(x + \varepsilon\right)\\
t_3 := {\sin x}^{2}\\
t_4 := -\frac{t_3}{t_0}\\
t_5 := 1 - t_4\\
t_6 := t_5 \cdot t_4 + \left(-0.5 \cdot t_5 + \left(0.16666666666666666 + t_3 \cdot \frac{0.16666666666666666}{t_0}\right)\right)\\
\mathbf{if}\;\varepsilon \leq -0.0195:\\
\;\;\;\;\left(\frac{t_1}{2} - \left(t_2 + \tan x\right)\right) + \left(\frac{t_2}{2} - \left(-t_2\right)\right)\\

\mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\
\;\;\;\;\left(\varepsilon \cdot t_5 + \frac{t_5 \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot t_6 + \left(\frac{\sin x \cdot t_6}{\cos x} + \frac{\sin x \cdot t_5}{\cos x} \cdot -0.3333333333333333\right) \cdot {\varepsilon}^{4}\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original36.9
Target14.9
Herbie14.2
\[\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)} \]

Derivation?

  1. Split input into 3 regimes
  2. if eps < -0.0195

    1. Initial program 29.8

      \[\tan \left(x + \varepsilon\right) - \tan x \]
    2. Applied egg-rr30.1

      \[\leadsto \color{blue}{\left(\frac{\tan \left(x + \varepsilon\right)}{2} - \left(\tan \left(x + \varepsilon\right) + \tan x\right)\right) + \left(\frac{\tan \left(x + \varepsilon\right)}{2} - \left(-\tan \left(x + \varepsilon\right)\right)\right)} \]
    3. Taylor expanded in x around 0 28.3

      \[\leadsto \left(\frac{\color{blue}{\frac{\sin \varepsilon}{\cos \varepsilon}}}{2} - \left(\tan \left(x + \varepsilon\right) + \tan x\right)\right) + \left(\frac{\tan \left(x + \varepsilon\right)}{2} - \left(-\tan \left(x + \varepsilon\right)\right)\right) \]

    if -0.0195 < eps < 2.3e-6

    1. Initial program 44.6

      \[\tan \left(x + \varepsilon\right) - \tan x \]
    2. Taylor expanded in eps around 0 0.3

      \[\leadsto \color{blue}{\varepsilon \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(\frac{{\varepsilon}^{2} \cdot \left(\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)}{\cos x} + \left(-1 \cdot \left(\left(-0.5 \cdot \frac{\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{\cos x} + \left(\frac{\left(0.16666666666666666 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}} + \left(0.16666666666666666 + \left(-1 \cdot \frac{{\sin x}^{2} \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{{\cos x}^{2}} + -0.5 \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)\right)\right) \cdot \sin x}{\cos x} + 0.16666666666666666 \cdot \frac{\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{\cos x}\right)\right) \cdot {\varepsilon}^{4}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot \left(0.16666666666666666 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}} + \left(0.16666666666666666 + \left(-1 \cdot \frac{{\sin x}^{2} \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{{\cos x}^{2}} + -0.5 \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)\right)\right)\right)\right)\right)} \]
    3. Simplified0.3

      \[\leadsto \color{blue}{\left(\varepsilon \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \frac{\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot \left(\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(-0.5 \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \left(0.16666666666666666 + {\sin x}^{2} \cdot \frac{0.16666666666666666}{{\cos x}^{2}}\right)\right)\right) + \left(\frac{\sin x \cdot \left(\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(-0.5 \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \left(0.16666666666666666 + {\sin x}^{2} \cdot \frac{0.16666666666666666}{{\cos x}^{2}}\right)\right)\right)}{\cos x} + \frac{\sin x \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)}{\cos x} \cdot -0.3333333333333333\right) \cdot {\varepsilon}^{4}\right)} \]
      Proof

      [Start]0.3

      \[ \varepsilon \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(\frac{{\varepsilon}^{2} \cdot \left(\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)}{\cos x} + \left(-1 \cdot \left(\left(-0.5 \cdot \frac{\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{\cos x} + \left(\frac{\left(0.16666666666666666 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}} + \left(0.16666666666666666 + \left(-1 \cdot \frac{{\sin x}^{2} \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{{\cos x}^{2}} + -0.5 \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)\right)\right) \cdot \sin x}{\cos x} + 0.16666666666666666 \cdot \frac{\sin x \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{\cos x}\right)\right) \cdot {\varepsilon}^{4}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot \left(0.16666666666666666 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}} + \left(0.16666666666666666 + \left(-1 \cdot \frac{{\sin x}^{2} \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)}{{\cos x}^{2}} + -0.5 \cdot \left(1 - -1 \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)\right)\right)\right)\right)\right) \]

    if 2.3e-6 < eps

    1. Initial program 28.9

      \[\tan \left(x + \varepsilon\right) - \tan x \]
    2. Applied egg-rr29.2

      \[\leadsto \color{blue}{\left(-1 - \left(-\tan \left(x + \varepsilon\right)\right)\right) + \left(1 - \tan x\right)} \]
    3. Taylor expanded in x around 0 27.3

      \[\leadsto \color{blue}{\frac{\sin \varepsilon}{\cos \varepsilon}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification14.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\varepsilon \leq -0.0195:\\ \;\;\;\;\left(\frac{\frac{\sin \varepsilon}{\cos \varepsilon}}{2} - \left(\tan \left(x + \varepsilon\right) + \tan x\right)\right) + \left(\frac{\tan \left(x + \varepsilon\right)}{2} - \left(-\tan \left(x + \varepsilon\right)\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\left(\varepsilon \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \frac{\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x}\right) + -1 \cdot \left({\varepsilon}^{3} \cdot \left(\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(-0.5 \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \left(0.16666666666666666 + {\sin x}^{2} \cdot \frac{0.16666666666666666}{{\cos x}^{2}}\right)\right)\right) + \left(\frac{\sin x \cdot \left(\left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) \cdot \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(-0.5 \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right) + \left(0.16666666666666666 + {\sin x}^{2} \cdot \frac{0.16666666666666666}{{\cos x}^{2}}\right)\right)\right)}{\cos x} + \frac{\sin x \cdot \left(1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\right)}{\cos x} \cdot -0.3333333333333333\right) \cdot {\varepsilon}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \varepsilon}{\cos \varepsilon}\\ \end{array} \]

Alternatives

Alternative 1
Error14.1
Cost183752
\[\begin{array}{l} t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ t_1 := {\cos x}^{2}\\ t_2 := {\sin x}^{2}\\ t_3 := \frac{t_2}{t_1}\\ t_4 := 1 - \left(-t_3\right)\\ \mathbf{if}\;\varepsilon \leq -0.105:\\ \;\;\;\;\tan x - \left(\tan \left(\varepsilon + x\right) \cdot -0.25 - \left(0.75 \cdot t_0 + \tan x \cdot -2\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon \cdot t_4 + \left(\frac{t_4 \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x} + \left(0.16666666666666666 \cdot t_3 + \left(0.16666666666666666 + \left(\left(-\frac{t_2 \cdot t_4}{t_1}\right) + -0.5 \cdot t_4\right)\right)\right) \cdot \left(-{\varepsilon}^{3}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error14.3
Cost72328
\[\begin{array}{l} t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ t_1 := 1 - \left(-\frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\\ t_2 := \tan \left(x + \varepsilon\right)\\ \mathbf{if}\;\varepsilon \leq -0.00022:\\ \;\;\;\;\left(\frac{t_0}{2} - \left(t_2 + \tan x\right)\right) + \left(\frac{t_2}{2} - \left(-t_2\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon \cdot t_1 + \frac{t_1 \cdot \left(\sin x \cdot {\varepsilon}^{2}\right)}{\cos x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error14.4
Cost39940
\[\begin{array}{l} t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ t_1 := \tan \left(x + \varepsilon\right)\\ \mathbf{if}\;\varepsilon \leq -0.00087:\\ \;\;\;\;\left(\frac{t_0}{2} - \left(t_1 + \tan x\right)\right) + \left(\frac{t_1}{2} - \left(-t_1\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error14.3
Cost33220
\[\begin{array}{l} t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ \mathbf{if}\;\varepsilon \leq -0.000335:\\ \;\;\;\;\tan x - \left(\tan \left(\varepsilon + x\right) \cdot -0.25 - \left(0.75 \cdot t_0 + \tan x \cdot -2\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error14.4
Cost26440
\[\begin{array}{l} t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\ \mathbf{if}\;\varepsilon \leq -0.102:\\ \;\;\;\;t_0 - \tan x\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error27.0
Cost12992
\[\frac{\sin \varepsilon}{\cos \varepsilon} \]
Alternative 7
Error28.1
Cost7048
\[\begin{array}{l} t_0 := \tan \left(x + \varepsilon\right)\\ \mathbf{if}\;\varepsilon \leq -8.4 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\varepsilon \leq 2.3 \cdot 10^{-6}:\\ \;\;\;\;\varepsilon + 0.3333333333333333 \cdot {\varepsilon}^{3}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error28.2
Cost6856
\[\begin{array}{l} t_0 := \tan \left(x + \varepsilon\right)\\ \mathbf{if}\;\varepsilon \leq -8.4 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\varepsilon \leq 3.1 \cdot 10^{-7}:\\ \;\;\;\;\varepsilon\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error61.3
Cost64
\[0 \]
Alternative 10
Error44.2
Cost64
\[\varepsilon \]

Error

Reproduce?

herbie shell --seed 2023100 
(FPCore (x eps)
  :name "2tan (problem 3.3.2)"
  :precision binary64

  :herbie-target
  (/ (sin eps) (* (cos x) (cos (+ x eps))))

  (- (tan (+ x eps)) (tan x)))