tan-example (used to crash)

Percentage Accurate: 79.1% → 99.7%
Time: 24.9s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\left(\left(\left(x = 0 \lor 0.5884142 \leq x \land x \leq 505.5909\right) \land \left(-1.796658 \cdot 10^{+308} \leq y \land y \leq -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \leq y \land y \leq 1.751224 \cdot 10^{+308}\right)\right) \land \left(-1.776707 \cdot 10^{+308} \leq z \land z \leq -8.599796 \cdot 10^{-310} \lor 3.293145 \cdot 10^{-311} \leq z \land z \leq 1.725154 \cdot 10^{+308}\right)\right) \land \left(-1.796658 \cdot 10^{+308} \leq a \land a \leq -9.425585 \cdot 10^{-310} \lor 1.284938 \cdot 10^{-309} \leq a \land a \leq 1.751224 \cdot 10^{+308}\right)\]
\[\begin{array}{l} \\ x + \left(\tan \left(y + z\right) - \tan a\right) \end{array} \]
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
	return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
	return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a):
	return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a)
	return Float64(x + Float64(tan(Float64(y + z)) - tan(a)))
end
function tmp = code(x, y, z, a)
	tmp = x + (tan((y + z)) - tan(a));
end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 79.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(\tan \left(y + z\right) - \tan a\right) \end{array} \]
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
	return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
	return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a):
	return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a)
	return Float64(x + Float64(tan(Float64(y + z)) - tan(a)))
end
function tmp = code(x, y, z, a)
	tmp = x + (tan((y + z)) - tan(a));
end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}

Alternative 1: 99.7% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\frac{1}{\frac{\cos y}{\sin y}}, 0 - \tan z, 1\right)} - \tan a\right) \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (+
  x
  (-
   (/
    (+ (tan y) (tan z))
    (fma (/ 1.0 (/ (cos y) (sin y))) (- 0.0 (tan z)) 1.0))
   (tan a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	return x + (((tan(y) + tan(z)) / fma((1.0 / (cos(y) / sin(y))), (0.0 - tan(z)), 1.0)) - tan(a));
}
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / fma(Float64(1.0 / Float64(cos(y) / sin(y))), Float64(0.0 - tan(z)), 1.0)) - tan(a)))
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(N[Cos[y], $MachinePrecision] / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.0 - N[Tan[z], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\frac{1}{\frac{\cos y}{\sin y}}, 0 - \tan z, 1\right)} - \tan a\right)
\end{array}
Derivation
  1. Initial program 83.7%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. tan-sumN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
    2. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    5. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. tan-lowering-tan.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  4. Applied egg-rr99.7%

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  5. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 + \left(\mathsf{neg}\left(\tan y \cdot \tan z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\left(\mathsf{neg}\left(\tan y \cdot \tan z\right)\right) + 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right) + 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. fma-defineN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\mathsf{fma}\left(\tan y, \mathsf{neg}\left(\tan z\right), 1\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    5. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\tan y, \left(\mathsf{neg}\left(\tan z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \left(\mathsf{neg}\left(\tan z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    7. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{neg.f64}\left(\tan z\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. tan-lowering-tan.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  6. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}} - \tan a\right) \]
  7. Step-by-step derivation
    1. tan-quotN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\left(\frac{\sin y}{\cos y}\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\left(\frac{1}{\frac{\cos y}{\sin y}}\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos y}{\sin y}\right)\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\cos y, \sin y\right)\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{cos.f64}\left(y\right), \sin y\right)\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. sin-lowering-sin.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{cos.f64}\left(y\right), \mathsf{sin.f64}\left(y\right)\right)\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\cos y}{\sin y}}}, -\tan z, 1\right)} - \tan a\right) \]
  9. Final simplification99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\frac{1}{\frac{\cos y}{\sin y}}, 0 - \tan z, 1\right)} - \tan a\right) \]
  10. Add Preprocessing

Alternative 2: 89.2% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -0.01:\\ \;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(t\_0 - \tan a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))))
   (if (<= (tan a) -0.01)
     (+ x (- (* (/ 1.0 (cos (+ y z))) (sin (+ y z))) (tan a)))
     (if (<= (tan a) 2e-6)
       (+ x (- (/ t_0 (- 1.0 (* (tan y) (tan z)))) a))
       (+ x (- t_0 (tan a)))))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double tmp;
	if (tan(a) <= -0.01) {
		tmp = x + (((1.0 / cos((y + z))) * sin((y + z))) - tan(a));
	} else if (tan(a) <= 2e-6) {
		tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
	} else {
		tmp = x + (t_0 - tan(a));
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    if (tan(a) <= (-0.01d0)) then
        tmp = x + (((1.0d0 / cos((y + z))) * sin((y + z))) - tan(a))
    else if (tan(a) <= 2d-6) then
        tmp = x + ((t_0 / (1.0d0 - (tan(y) * tan(z)))) - a)
    else
        tmp = x + (t_0 - tan(a))
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double tmp;
	if (Math.tan(a) <= -0.01) {
		tmp = x + (((1.0 / Math.cos((y + z))) * Math.sin((y + z))) - Math.tan(a));
	} else if (Math.tan(a) <= 2e-6) {
		tmp = x + ((t_0 / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
	} else {
		tmp = x + (t_0 - Math.tan(a));
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	tmp = 0
	if math.tan(a) <= -0.01:
		tmp = x + (((1.0 / math.cos((y + z))) * math.sin((y + z))) - math.tan(a))
	elif math.tan(a) <= 2e-6:
		tmp = x + ((t_0 / (1.0 - (math.tan(y) * math.tan(z)))) - a)
	else:
		tmp = x + (t_0 - math.tan(a))
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	tmp = 0.0
	if (tan(a) <= -0.01)
		tmp = Float64(x + Float64(Float64(Float64(1.0 / cos(Float64(y + z))) * sin(Float64(y + z))) - tan(a)));
	elseif (tan(a) <= 2e-6)
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))) - a));
	else
		tmp = Float64(x + Float64(t_0 - tan(a)));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	tmp = 0.0;
	if (tan(a) <= -0.01)
		tmp = x + (((1.0 / cos((y + z))) * sin((y + z))) - tan(a));
	elseif (tan(a) <= 2e-6)
		tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
	else
		tmp = x + (t_0 - tan(a));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[(x + N[(N[(N[(1.0 / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 2e-6], N[(x + N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\

\mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(t\_0 - \tan a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (tan.f64 a) < -0.0100000000000000002

    1. Initial program 91.2%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
      3. associate-/r/N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\cos \left(y + z\right)}\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \cos \left(y + z\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{sin.f64}\left(\left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. +-lowering-+.f6491.3%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr91.3%

      \[\leadsto x + \left(\color{blue}{\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right)} - \tan a\right) \]

    if -0.0100000000000000002 < (tan.f64 a) < 1.99999999999999991e-6

    1. Initial program 81.2%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
    4. Step-by-step derivation
      1. Simplified81.2%

        \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{a}\right) \]
      2. Step-by-step derivation
        1. tan-sumN/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), a\right)\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), a\right)\right) \]
        3. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), a\right)\right) \]
        4. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), a\right)\right) \]
        5. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), a\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), a\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), a\right)\right) \]
        8. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), a\right)\right) \]
        9. tan-lowering-tan.f6499.7%

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), a\right)\right) \]
      3. Applied egg-rr99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - a\right) \]

      if 1.99999999999999991e-6 < (tan.f64 a)

      1. Initial program 83.0%

        \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. tan-sumN/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
        3. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        4. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        5. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        8. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        9. tan-lowering-tan.f6499.7%

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. Applied egg-rr99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      5. Taylor expanded in y around 0

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \color{blue}{1}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. Step-by-step derivation
        1. Simplified83.3%

          \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1}} - \tan a\right) \]
      7. Recombined 3 regimes into one program.
      8. Final simplification93.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -0.01:\\ \;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\ \;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(\tan y + \tan z\right) - \tan a\right)\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 88.9% accurate, 0.3× speedup?

      \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -0.01:\\ \;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\ \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(t\_0 - \tan a\right)\\ \end{array} \end{array} \]
      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
      (FPCore (x y z a)
       :precision binary64
       (let* ((t_0 (+ (tan y) (tan z))))
         (if (<= (tan a) -0.01)
           (+ x (- (* (/ 1.0 (cos (+ y z))) (sin (+ y z))) (tan a)))
           (if (<= (tan a) 2e-6)
             (+ x (/ t_0 (- 1.0 (* (tan y) (tan z)))))
             (+ x (- t_0 (tan a)))))))
      assert(x < y && y < z && z < a);
      double code(double x, double y, double z, double a) {
      	double t_0 = tan(y) + tan(z);
      	double tmp;
      	if (tan(a) <= -0.01) {
      		tmp = x + (((1.0 / cos((y + z))) * sin((y + z))) - tan(a));
      	} else if (tan(a) <= 2e-6) {
      		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
      	} else {
      		tmp = x + (t_0 - tan(a));
      	}
      	return tmp;
      }
      
      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
      real(8) function code(x, y, z, a)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8), intent (in) :: a
          real(8) :: t_0
          real(8) :: tmp
          t_0 = tan(y) + tan(z)
          if (tan(a) <= (-0.01d0)) then
              tmp = x + (((1.0d0 / cos((y + z))) * sin((y + z))) - tan(a))
          else if (tan(a) <= 2d-6) then
              tmp = x + (t_0 / (1.0d0 - (tan(y) * tan(z))))
          else
              tmp = x + (t_0 - tan(a))
          end if
          code = tmp
      end function
      
      assert x < y && y < z && z < a;
      public static double code(double x, double y, double z, double a) {
      	double t_0 = Math.tan(y) + Math.tan(z);
      	double tmp;
      	if (Math.tan(a) <= -0.01) {
      		tmp = x + (((1.0 / Math.cos((y + z))) * Math.sin((y + z))) - Math.tan(a));
      	} else if (Math.tan(a) <= 2e-6) {
      		tmp = x + (t_0 / (1.0 - (Math.tan(y) * Math.tan(z))));
      	} else {
      		tmp = x + (t_0 - Math.tan(a));
      	}
      	return tmp;
      }
      
      [x, y, z, a] = sort([x, y, z, a])
      def code(x, y, z, a):
      	t_0 = math.tan(y) + math.tan(z)
      	tmp = 0
      	if math.tan(a) <= -0.01:
      		tmp = x + (((1.0 / math.cos((y + z))) * math.sin((y + z))) - math.tan(a))
      	elif math.tan(a) <= 2e-6:
      		tmp = x + (t_0 / (1.0 - (math.tan(y) * math.tan(z))))
      	else:
      		tmp = x + (t_0 - math.tan(a))
      	return tmp
      
      x, y, z, a = sort([x, y, z, a])
      function code(x, y, z, a)
      	t_0 = Float64(tan(y) + tan(z))
      	tmp = 0.0
      	if (tan(a) <= -0.01)
      		tmp = Float64(x + Float64(Float64(Float64(1.0 / cos(Float64(y + z))) * sin(Float64(y + z))) - tan(a)));
      	elseif (tan(a) <= 2e-6)
      		tmp = Float64(x + Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))));
      	else
      		tmp = Float64(x + Float64(t_0 - tan(a)));
      	end
      	return tmp
      end
      
      x, y, z, a = num2cell(sort([x, y, z, a])){:}
      function tmp_2 = code(x, y, z, a)
      	t_0 = tan(y) + tan(z);
      	tmp = 0.0;
      	if (tan(a) <= -0.01)
      		tmp = x + (((1.0 / cos((y + z))) * sin((y + z))) - tan(a));
      	elseif (tan(a) <= 2e-6)
      		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
      	else
      		tmp = x + (t_0 - tan(a));
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
      code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[(x + N[(N[(N[(1.0 / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 2e-6], N[(x + N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
      
      \begin{array}{l}
      [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
      \\
      \begin{array}{l}
      t_0 := \tan y + \tan z\\
      \mathbf{if}\;\tan a \leq -0.01:\\
      \;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\
      
      \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\
      \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\
      
      \mathbf{else}:\\
      \;\;\;\;x + \left(t\_0 - \tan a\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (tan.f64 a) < -0.0100000000000000002

        1. Initial program 91.2%

          \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. tan-quotN/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
          2. clear-numN/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
          3. associate-/r/N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\cos \left(y + z\right)}\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
          5. /-lowering-/.f64N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \cos \left(y + z\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          6. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          7. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \sin \left(y + z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          8. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{sin.f64}\left(\left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          9. +-lowering-+.f6491.3%

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        4. Applied egg-rr91.3%

          \[\leadsto x + \left(\color{blue}{\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right)} - \tan a\right) \]

        if -0.0100000000000000002 < (tan.f64 a) < 1.99999999999999991e-6

        1. Initial program 81.2%

          \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \left(\tan \left(y + z\right) - \tan a\right) + \color{blue}{x} \]
          2. associate-+l-N/A

            \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(\tan a - x\right)} \]
          3. tan-sumN/A

            \[\leadsto \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \left(\color{blue}{\tan a} - x\right) \]
          4. div-invN/A

            \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} - \left(\color{blue}{\tan a} - x\right) \]
          5. fmm-defN/A

            \[\leadsto \mathsf{fma}\left(\tan y + \tan z, \color{blue}{\frac{1}{1 - \tan y \cdot \tan z}}, \mathsf{neg}\left(\left(\tan a - x\right)\right)\right) \]
          6. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\left(\tan y + \tan z\right), \color{blue}{\left(\frac{1}{1 - \tan y \cdot \tan z}\right)}, \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          7. +-lowering-+.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(\frac{\color{blue}{1}}{1 - \tan y \cdot \tan z}\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          8. tan-lowering-tan.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(\frac{1}{1 - \tan y \cdot \tan z}\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          9. tan-lowering-tan.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\frac{1}{1 - \tan y \cdot \tan z}\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(1 - \tan y \cdot \tan z\right)}\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          11. --lowering--.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \color{blue}{\left(\tan y \cdot \tan z\right)}\right)\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          12. *-lowering-*.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \color{blue}{\tan z}\right)\right)\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          13. tan-lowering-tan.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan \color{blue}{z}\right)\right)\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          14. tan-lowering-tan.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \left(\mathsf{neg}\left(\left(\tan a - x\right)\right)\right)\right) \]
          15. neg-lowering-neg.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{neg.f64}\left(\left(\tan a - x\right)\right)\right) \]
          16. --lowering--.f64N/A

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{neg.f64}\left(\mathsf{\_.f64}\left(\tan a, x\right)\right)\right) \]
          17. tan-lowering-tan.f6499.7%

            \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{neg.f64}\left(\mathsf{\_.f64}\left(\mathsf{tan.f64}\left(a\right), x\right)\right)\right) \]
        4. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, -\left(\tan a - x\right)\right)} \]
        5. Taylor expanded in a around 0

          \[\leadsto \mathsf{fma.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \color{blue}{x}\right) \]
        6. Step-by-step derivation
          1. Simplified98.4%

            \[\leadsto \mathsf{fma}\left(\tan y + \tan z, \frac{1}{1 - \tan y \cdot \tan z}, \color{blue}{x}\right) \]
          2. Step-by-step derivation
            1. sub-negN/A

              \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{1 + \left(\mathsf{neg}\left(\tan y \cdot \tan z\right)\right)} + x \]
            2. distribute-rgt-neg-outN/A

              \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{1 + \tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right)} + x \]
            3. +-commutativeN/A

              \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{\tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right) + 1} + x \]
            4. div-invN/A

              \[\leadsto \frac{\tan y + \tan z}{\tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right) + 1} + x \]
            5. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(\left(\frac{\tan y + \tan z}{\tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right) + 1}\right), \color{blue}{x}\right) \]
          3. Applied egg-rr98.4%

            \[\leadsto \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} + x} \]

          if 1.99999999999999991e-6 < (tan.f64 a)

          1. Initial program 83.0%

            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. tan-sumN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            9. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Applied egg-rr99.7%

            \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
          5. Taylor expanded in y around 0

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \color{blue}{1}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified83.3%

              \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1}} - \tan a\right) \]
          7. Recombined 3 regimes into one program.
          8. Final simplification93.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -0.01:\\ \;\;\;\;x + \left(\frac{1}{\cos \left(y + z\right)} \cdot \sin \left(y + z\right) - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-6}:\\ \;\;\;\;x + \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(\tan y + \tan z\right) - \tan a\right)\\ \end{array} \]
          9. Add Preprocessing

          Alternative 4: 99.7% accurate, 0.3× speedup?

          \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\frac{\tan y + \tan z}{1 - \frac{\tan y \cdot \sin z}{\cos z}} - \tan a\right) \end{array} \]
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          (FPCore (x y z a)
           :precision binary64
           (+
            x
            (- (/ (+ (tan y) (tan z)) (- 1.0 (/ (* (tan y) (sin z)) (cos z)))) (tan a))))
          assert(x < y && y < z && z < a);
          double code(double x, double y, double z, double a) {
          	return x + (((tan(y) + tan(z)) / (1.0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a));
          }
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          real(8) function code(x, y, z, a)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: a
              code = x + (((tan(y) + tan(z)) / (1.0d0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a))
          end function
          
          assert x < y && y < z && z < a;
          public static double code(double x, double y, double z, double a) {
          	return x + (((Math.tan(y) + Math.tan(z)) / (1.0 - ((Math.tan(y) * Math.sin(z)) / Math.cos(z)))) - Math.tan(a));
          }
          
          [x, y, z, a] = sort([x, y, z, a])
          def code(x, y, z, a):
          	return x + (((math.tan(y) + math.tan(z)) / (1.0 - ((math.tan(y) * math.sin(z)) / math.cos(z)))) - math.tan(a))
          
          x, y, z, a = sort([x, y, z, a])
          function code(x, y, z, a)
          	return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(Float64(tan(y) * sin(z)) / cos(z)))) - tan(a)))
          end
          
          x, y, z, a = num2cell(sort([x, y, z, a])){:}
          function tmp = code(x, y, z, a)
          	tmp = x + (((tan(y) + tan(z)) / (1.0 - ((tan(y) * sin(z)) / cos(z)))) - tan(a));
          end
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[(N[Tan[y], $MachinePrecision] * N[Sin[z], $MachinePrecision]), $MachinePrecision] / N[Cos[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
          \\
          x + \left(\frac{\tan y + \tan z}{1 - \frac{\tan y \cdot \sin z}{\cos z}} - \tan a\right)
          \end{array}
          
          Derivation
          1. Initial program 83.7%

            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. tan-sumN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            9. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Applied egg-rr99.7%

            \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
          5. Step-by-step derivation
            1. tan-quotN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \frac{\sin z}{\cos z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            2. associate-*r/N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan y \cdot \sin z}{\cos z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            3. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\tan y \cdot \sin z\right), \cos z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\tan y, \sin z\right), \cos z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \sin z\right), \cos z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{sin.f64}\left(z\right)\right), \cos z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. cos-lowering-cos.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{sin.f64}\left(z\right)\right), \mathsf{cos.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          6. Applied egg-rr99.7%

            \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}} - \tan a\right) \]
          7. Add Preprocessing

          Alternative 5: 99.7% accurate, 0.3× speedup?

          \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\tan y, 0 - \tan z, 1\right)} - \tan a\right) \end{array} \]
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          (FPCore (x y z a)
           :precision binary64
           (+ x (- (/ (+ (tan y) (tan z)) (fma (tan y) (- 0.0 (tan z)) 1.0)) (tan a))))
          assert(x < y && y < z && z < a);
          double code(double x, double y, double z, double a) {
          	return x + (((tan(y) + tan(z)) / fma(tan(y), (0.0 - tan(z)), 1.0)) - tan(a));
          }
          
          x, y, z, a = sort([x, y, z, a])
          function code(x, y, z, a)
          	return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / fma(tan(y), Float64(0.0 - tan(z)), 1.0)) - tan(a)))
          end
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(N[Tan[y], $MachinePrecision] * N[(0.0 - N[Tan[z], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
          \\
          x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\tan y, 0 - \tan z, 1\right)} - \tan a\right)
          \end{array}
          
          Derivation
          1. Initial program 83.7%

            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. tan-sumN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            9. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Applied egg-rr99.7%

            \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
          5. Step-by-step derivation
            1. sub-negN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 + \left(\mathsf{neg}\left(\tan y \cdot \tan z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\left(\mathsf{neg}\left(\tan y \cdot \tan z\right)\right) + 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            3. distribute-rgt-neg-inN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\tan y \cdot \left(\mathsf{neg}\left(\tan z\right)\right) + 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. fma-defineN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(\mathsf{fma}\left(\tan y, \mathsf{neg}\left(\tan z\right), 1\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. fma-lowering-fma.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\tan y, \left(\mathsf{neg}\left(\tan z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \left(\mathsf{neg}\left(\tan z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. neg-lowering-neg.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{neg.f64}\left(\tan z\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{fma.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{neg.f64}\left(\mathsf{tan.f64}\left(z\right)\right), 1\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          6. Applied egg-rr99.7%

            \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}} - \tan a\right) \]
          7. Final simplification99.7%

            \[\leadsto x + \left(\frac{\tan y + \tan z}{\mathsf{fma}\left(\tan y, 0 - \tan z, 1\right)} - \tan a\right) \]
          8. Add Preprocessing

          Alternative 6: 99.7% accurate, 0.4× speedup?

          \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \end{array} \]
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          (FPCore (x y z a)
           :precision binary64
           (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (tan a))))
          assert(x < y && y < z && z < a);
          double code(double x, double y, double z, double a) {
          	return x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
          }
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          real(8) function code(x, y, z, a)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: a
              code = x + (((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) - tan(a))
          end function
          
          assert x < y && y < z && z < a;
          public static double code(double x, double y, double z, double a) {
          	return x + (((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) - Math.tan(a));
          }
          
          [x, y, z, a] = sort([x, y, z, a])
          def code(x, y, z, a):
          	return x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) - math.tan(a))
          
          x, y, z, a = sort([x, y, z, a])
          function code(x, y, z, a)
          	return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) - tan(a)))
          end
          
          x, y, z, a = num2cell(sort([x, y, z, a])){:}
          function tmp = code(x, y, z, a)
          	tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
          end
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          code[x_, y_, z_, a_] := N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
          \\
          x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)
          \end{array}
          
          Derivation
          1. Initial program 83.7%

            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. tan-sumN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            9. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Applied egg-rr99.7%

            \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
          5. Add Preprocessing

          Alternative 7: 79.5% accurate, 0.7× speedup?

          \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\left(\tan y + \tan z\right) - \tan a\right) \end{array} \]
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          (FPCore (x y z a) :precision binary64 (+ x (- (+ (tan y) (tan z)) (tan a))))
          assert(x < y && y < z && z < a);
          double code(double x, double y, double z, double a) {
          	return x + ((tan(y) + tan(z)) - tan(a));
          }
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          real(8) function code(x, y, z, a)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: a
              code = x + ((tan(y) + tan(z)) - tan(a))
          end function
          
          assert x < y && y < z && z < a;
          public static double code(double x, double y, double z, double a) {
          	return x + ((Math.tan(y) + Math.tan(z)) - Math.tan(a));
          }
          
          [x, y, z, a] = sort([x, y, z, a])
          def code(x, y, z, a):
          	return x + ((math.tan(y) + math.tan(z)) - math.tan(a))
          
          x, y, z, a = sort([x, y, z, a])
          function code(x, y, z, a)
          	return Float64(x + Float64(Float64(tan(y) + tan(z)) - tan(a)))
          end
          
          x, y, z, a = num2cell(sort([x, y, z, a])){:}
          function tmp = code(x, y, z, a)
          	tmp = x + ((tan(y) + tan(z)) - tan(a));
          end
          
          NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
          code[x_, y_, z_, a_] := N[(x + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
          \\
          x + \left(\left(\tan y + \tan z\right) - \tan a\right)
          \end{array}
          
          Derivation
          1. Initial program 83.7%

            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. tan-sumN/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            2. /-lowering-/.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
            3. +-lowering-+.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            5. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            8. tan-lowering-tan.f64N/A

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            9. tan-lowering-tan.f6499.7%

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Applied egg-rr99.7%

            \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
          5. Taylor expanded in y around 0

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \color{blue}{1}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified83.9%

              \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1}} - \tan a\right) \]
            2. Final simplification83.9%

              \[\leadsto x + \left(\left(\tan y + \tan z\right) - \tan a\right) \]
            3. Add Preprocessing

            Alternative 8: 69.1% accurate, 1.0× speedup?

            \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x + \left(\tan y - \tan a\right)\\ \mathbf{if}\;a \leq -0.00082:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.00044:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
            (FPCore (x y z a)
             :precision binary64
             (let* ((t_0 (+ x (- (tan y) (tan a)))))
               (if (<= a -0.00082) t_0 (if (<= a 0.00044) (+ x (- (tan (+ y z)) a)) t_0))))
            assert(x < y && y < z && z < a);
            double code(double x, double y, double z, double a) {
            	double t_0 = x + (tan(y) - tan(a));
            	double tmp;
            	if (a <= -0.00082) {
            		tmp = t_0;
            	} else if (a <= 0.00044) {
            		tmp = x + (tan((y + z)) - a);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
            real(8) function code(x, y, z, a)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: a
                real(8) :: t_0
                real(8) :: tmp
                t_0 = x + (tan(y) - tan(a))
                if (a <= (-0.00082d0)) then
                    tmp = t_0
                else if (a <= 0.00044d0) then
                    tmp = x + (tan((y + z)) - a)
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            assert x < y && y < z && z < a;
            public static double code(double x, double y, double z, double a) {
            	double t_0 = x + (Math.tan(y) - Math.tan(a));
            	double tmp;
            	if (a <= -0.00082) {
            		tmp = t_0;
            	} else if (a <= 0.00044) {
            		tmp = x + (Math.tan((y + z)) - a);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            [x, y, z, a] = sort([x, y, z, a])
            def code(x, y, z, a):
            	t_0 = x + (math.tan(y) - math.tan(a))
            	tmp = 0
            	if a <= -0.00082:
            		tmp = t_0
            	elif a <= 0.00044:
            		tmp = x + (math.tan((y + z)) - a)
            	else:
            		tmp = t_0
            	return tmp
            
            x, y, z, a = sort([x, y, z, a])
            function code(x, y, z, a)
            	t_0 = Float64(x + Float64(tan(y) - tan(a)))
            	tmp = 0.0
            	if (a <= -0.00082)
            		tmp = t_0;
            	elseif (a <= 0.00044)
            		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            x, y, z, a = num2cell(sort([x, y, z, a])){:}
            function tmp_2 = code(x, y, z, a)
            	t_0 = x + (tan(y) - tan(a));
            	tmp = 0.0;
            	if (a <= -0.00082)
            		tmp = t_0;
            	elseif (a <= 0.00044)
            		tmp = x + (tan((y + z)) - a);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
            code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.00082], t$95$0, If[LessEqual[a, 0.00044], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
            \\
            \begin{array}{l}
            t_0 := x + \left(\tan y - \tan a\right)\\
            \mathbf{if}\;a \leq -0.00082:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;a \leq 0.00044:\\
            \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if a < -8.1999999999999998e-4 or 4.40000000000000016e-4 < a

              1. Initial program 86.8%

                \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
              2. Add Preprocessing
              3. Taylor expanded in y around inf

                \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{y}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
              4. Step-by-step derivation
                1. Simplified58.7%

                  \[\leadsto x + \left(\tan \color{blue}{y} - \tan a\right) \]

                if -8.1999999999999998e-4 < a < 4.40000000000000016e-4

                1. Initial program 81.2%

                  \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                2. Add Preprocessing
                3. Taylor expanded in a around 0

                  \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
                4. Step-by-step derivation
                  1. Simplified81.2%

                    \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{a}\right) \]
                5. Recombined 2 regimes into one program.
                6. Add Preprocessing

                Alternative 9: 79.0% accurate, 1.0× speedup?

                \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;y + z \leq -5 \cdot 10^{-13}:\\ \;\;\;\;x + \left(\tan y - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan z - \tan a\right)\\ \end{array} \end{array} \]
                NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                (FPCore (x y z a)
                 :precision binary64
                 (if (<= (+ y z) -5e-13) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
                assert(x < y && y < z && z < a);
                double code(double x, double y, double z, double a) {
                	double tmp;
                	if ((y + z) <= -5e-13) {
                		tmp = x + (tan(y) - tan(a));
                	} else {
                		tmp = x + (tan(z) - tan(a));
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                real(8) function code(x, y, z, a)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: a
                    real(8) :: tmp
                    if ((y + z) <= (-5d-13)) then
                        tmp = x + (tan(y) - tan(a))
                    else
                        tmp = x + (tan(z) - tan(a))
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < a;
                public static double code(double x, double y, double z, double a) {
                	double tmp;
                	if ((y + z) <= -5e-13) {
                		tmp = x + (Math.tan(y) - Math.tan(a));
                	} else {
                		tmp = x + (Math.tan(z) - Math.tan(a));
                	}
                	return tmp;
                }
                
                [x, y, z, a] = sort([x, y, z, a])
                def code(x, y, z, a):
                	tmp = 0
                	if (y + z) <= -5e-13:
                		tmp = x + (math.tan(y) - math.tan(a))
                	else:
                		tmp = x + (math.tan(z) - math.tan(a))
                	return tmp
                
                x, y, z, a = sort([x, y, z, a])
                function code(x, y, z, a)
                	tmp = 0.0
                	if (Float64(y + z) <= -5e-13)
                		tmp = Float64(x + Float64(tan(y) - tan(a)));
                	else
                		tmp = Float64(x + Float64(tan(z) - tan(a)));
                	end
                	return tmp
                end
                
                x, y, z, a = num2cell(sort([x, y, z, a])){:}
                function tmp_2 = code(x, y, z, a)
                	tmp = 0.0;
                	if ((y + z) <= -5e-13)
                		tmp = x + (tan(y) - tan(a));
                	else
                		tmp = x + (tan(z) - tan(a));
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -5e-13], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y + z \leq -5 \cdot 10^{-13}:\\
                \;\;\;\;x + \left(\tan y - \tan a\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;x + \left(\tan z - \tan a\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (+.f64 y z) < -4.9999999999999999e-13

                  1. Initial program 77.1%

                    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in y around inf

                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{y}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                  4. Step-by-step derivation
                    1. Simplified49.1%

                      \[\leadsto x + \left(\tan \color{blue}{y} - \tan a\right) \]

                    if -4.9999999999999999e-13 < (+.f64 y z)

                    1. Initial program 88.9%

                      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in y around 0

                      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{z}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                    4. Step-by-step derivation
                      1. Simplified74.0%

                        \[\leadsto x + \left(\tan \color{blue}{z} - \tan a\right) \]
                    5. Recombined 2 regimes into one program.
                    6. Add Preprocessing

                    Alternative 10: 79.1% accurate, 1.0× speedup?

                    \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\tan \left(y + z\right) - \tan a\right) \end{array} \]
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    (FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
                    assert(x < y && y < z && z < a);
                    double code(double x, double y, double z, double a) {
                    	return x + (tan((y + z)) - tan(a));
                    }
                    
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    real(8) function code(x, y, z, a)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8), intent (in) :: a
                        code = x + (tan((y + z)) - tan(a))
                    end function
                    
                    assert x < y && y < z && z < a;
                    public static double code(double x, double y, double z, double a) {
                    	return x + (Math.tan((y + z)) - Math.tan(a));
                    }
                    
                    [x, y, z, a] = sort([x, y, z, a])
                    def code(x, y, z, a):
                    	return x + (math.tan((y + z)) - math.tan(a))
                    
                    x, y, z, a = sort([x, y, z, a])
                    function code(x, y, z, a)
                    	return Float64(x + Float64(tan(Float64(y + z)) - tan(a)))
                    end
                    
                    x, y, z, a = num2cell(sort([x, y, z, a])){:}
                    function tmp = code(x, y, z, a)
                    	tmp = x + (tan((y + z)) - tan(a));
                    end
                    
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                    \\
                    x + \left(\tan \left(y + z\right) - \tan a\right)
                    \end{array}
                    
                    Derivation
                    1. Initial program 83.7%

                      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                    2. Add Preprocessing
                    3. Add Preprocessing

                    Alternative 11: 59.8% accurate, 1.7× speedup?

                    \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x + \left(\frac{1}{\frac{1 + -0.3333333333333333 \cdot \left(z \cdot z\right)}{z}} - \tan a\right)\\ \mathbf{if}\;a \leq -0.19:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 7.2 \cdot 10^{-7}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    (FPCore (x y z a)
                     :precision binary64
                     (let* ((t_0
                             (+
                              x
                              (- (/ 1.0 (/ (+ 1.0 (* -0.3333333333333333 (* z z))) z)) (tan a)))))
                       (if (<= a -0.19) t_0 (if (<= a 7.2e-7) (+ x (- (tan (+ y z)) a)) t_0))))
                    assert(x < y && y < z && z < a);
                    double code(double x, double y, double z, double a) {
                    	double t_0 = x + ((1.0 / ((1.0 + (-0.3333333333333333 * (z * z))) / z)) - tan(a));
                    	double tmp;
                    	if (a <= -0.19) {
                    		tmp = t_0;
                    	} else if (a <= 7.2e-7) {
                    		tmp = x + (tan((y + z)) - a);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    real(8) function code(x, y, z, a)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8), intent (in) :: a
                        real(8) :: t_0
                        real(8) :: tmp
                        t_0 = x + ((1.0d0 / ((1.0d0 + ((-0.3333333333333333d0) * (z * z))) / z)) - tan(a))
                        if (a <= (-0.19d0)) then
                            tmp = t_0
                        else if (a <= 7.2d-7) then
                            tmp = x + (tan((y + z)) - a)
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    assert x < y && y < z && z < a;
                    public static double code(double x, double y, double z, double a) {
                    	double t_0 = x + ((1.0 / ((1.0 + (-0.3333333333333333 * (z * z))) / z)) - Math.tan(a));
                    	double tmp;
                    	if (a <= -0.19) {
                    		tmp = t_0;
                    	} else if (a <= 7.2e-7) {
                    		tmp = x + (Math.tan((y + z)) - a);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    [x, y, z, a] = sort([x, y, z, a])
                    def code(x, y, z, a):
                    	t_0 = x + ((1.0 / ((1.0 + (-0.3333333333333333 * (z * z))) / z)) - math.tan(a))
                    	tmp = 0
                    	if a <= -0.19:
                    		tmp = t_0
                    	elif a <= 7.2e-7:
                    		tmp = x + (math.tan((y + z)) - a)
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    x, y, z, a = sort([x, y, z, a])
                    function code(x, y, z, a)
                    	t_0 = Float64(x + Float64(Float64(1.0 / Float64(Float64(1.0 + Float64(-0.3333333333333333 * Float64(z * z))) / z)) - tan(a)))
                    	tmp = 0.0
                    	if (a <= -0.19)
                    		tmp = t_0;
                    	elseif (a <= 7.2e-7)
                    		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    x, y, z, a = num2cell(sort([x, y, z, a])){:}
                    function tmp_2 = code(x, y, z, a)
                    	t_0 = x + ((1.0 / ((1.0 + (-0.3333333333333333 * (z * z))) / z)) - tan(a));
                    	tmp = 0.0;
                    	if (a <= -0.19)
                    		tmp = t_0;
                    	elseif (a <= 7.2e-7)
                    		tmp = x + (tan((y + z)) - a);
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                    code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[(1.0 / N[(N[(1.0 + N[(-0.3333333333333333 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.19], t$95$0, If[LessEqual[a, 7.2e-7], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                    
                    \begin{array}{l}
                    [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                    \\
                    \begin{array}{l}
                    t_0 := x + \left(\frac{1}{\frac{1 + -0.3333333333333333 \cdot \left(z \cdot z\right)}{z}} - \tan a\right)\\
                    \mathbf{if}\;a \leq -0.19:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;a \leq 7.2 \cdot 10^{-7}:\\
                    \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if a < -0.19 or 7.19999999999999989e-7 < a

                      1. Initial program 85.7%

                        \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. tan-quotN/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                        2. clear-numN/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                        3. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                        4. clear-numN/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        5. tan-quotN/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\tan \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        6. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \tan \left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        7. tan-lowering-tan.f64N/A

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\left(y + z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        8. +-lowering-+.f6485.7%

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                      4. Applied egg-rr85.7%

                        \[\leadsto x + \left(\color{blue}{\frac{1}{\frac{1}{\tan \left(y + z\right)}}} - \tan a\right) \]
                      5. Taylor expanded in y around 0

                        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\color{blue}{z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                      6. Step-by-step derivation
                        1. Simplified66.3%

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

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1 + \frac{-1}{3} \cdot {z}^{2}}{z}\right)}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        3. Step-by-step derivation
                          1. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(1 + \frac{-1}{3} \cdot {z}^{2}\right), z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          2. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{3} \cdot {z}^{2}\right)\right), z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          3. *-lowering-*.f64N/A

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left({z}^{2}\right)\right)\right), z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          4. unpow2N/A

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left(z \cdot z\right)\right)\right), z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          5. *-lowering-*.f6439.7%

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(z, z\right)\right)\right), z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                        4. Simplified39.7%

                          \[\leadsto x + \left(\frac{1}{\color{blue}{\frac{1 + -0.3333333333333333 \cdot \left(z \cdot z\right)}{z}}} - \tan a\right) \]

                        if -0.19 < a < 7.19999999999999989e-7

                        1. Initial program 82.0%

                          \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in a around 0

                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
                        4. Step-by-step derivation
                          1. Simplified82.0%

                            \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{a}\right) \]
                        5. Recombined 2 regimes into one program.
                        6. Add Preprocessing

                        Alternative 12: 54.4% accurate, 1.8× speedup?

                        \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x + \left(z - \tan a\right)\\ \mathbf{if}\;a \leq -400000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 1.2 \cdot 10^{+16}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                        NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                        (FPCore (x y z a)
                         :precision binary64
                         (let* ((t_0 (+ x (- z (tan a)))))
                           (if (<= a -400000000.0)
                             t_0
                             (if (<= a 1.2e+16) (+ x (- (tan (+ y z)) a)) t_0))))
                        assert(x < y && y < z && z < a);
                        double code(double x, double y, double z, double a) {
                        	double t_0 = x + (z - tan(a));
                        	double tmp;
                        	if (a <= -400000000.0) {
                        		tmp = t_0;
                        	} else if (a <= 1.2e+16) {
                        		tmp = x + (tan((y + z)) - a);
                        	} else {
                        		tmp = t_0;
                        	}
                        	return tmp;
                        }
                        
                        NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                        real(8) function code(x, y, z, a)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8), intent (in) :: z
                            real(8), intent (in) :: a
                            real(8) :: t_0
                            real(8) :: tmp
                            t_0 = x + (z - tan(a))
                            if (a <= (-400000000.0d0)) then
                                tmp = t_0
                            else if (a <= 1.2d+16) then
                                tmp = x + (tan((y + z)) - a)
                            else
                                tmp = t_0
                            end if
                            code = tmp
                        end function
                        
                        assert x < y && y < z && z < a;
                        public static double code(double x, double y, double z, double a) {
                        	double t_0 = x + (z - Math.tan(a));
                        	double tmp;
                        	if (a <= -400000000.0) {
                        		tmp = t_0;
                        	} else if (a <= 1.2e+16) {
                        		tmp = x + (Math.tan((y + z)) - a);
                        	} else {
                        		tmp = t_0;
                        	}
                        	return tmp;
                        }
                        
                        [x, y, z, a] = sort([x, y, z, a])
                        def code(x, y, z, a):
                        	t_0 = x + (z - math.tan(a))
                        	tmp = 0
                        	if a <= -400000000.0:
                        		tmp = t_0
                        	elif a <= 1.2e+16:
                        		tmp = x + (math.tan((y + z)) - a)
                        	else:
                        		tmp = t_0
                        	return tmp
                        
                        x, y, z, a = sort([x, y, z, a])
                        function code(x, y, z, a)
                        	t_0 = Float64(x + Float64(z - tan(a)))
                        	tmp = 0.0
                        	if (a <= -400000000.0)
                        		tmp = t_0;
                        	elseif (a <= 1.2e+16)
                        		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
                        	else
                        		tmp = t_0;
                        	end
                        	return tmp
                        end
                        
                        x, y, z, a = num2cell(sort([x, y, z, a])){:}
                        function tmp_2 = code(x, y, z, a)
                        	t_0 = x + (z - tan(a));
                        	tmp = 0.0;
                        	if (a <= -400000000.0)
                        		tmp = t_0;
                        	elseif (a <= 1.2e+16)
                        		tmp = x + (tan((y + z)) - a);
                        	else
                        		tmp = t_0;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                        code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(z - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -400000000.0], t$95$0, If[LessEqual[a, 1.2e+16], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                        
                        \begin{array}{l}
                        [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                        \\
                        \begin{array}{l}
                        t_0 := x + \left(z - \tan a\right)\\
                        \mathbf{if}\;a \leq -400000000:\\
                        \;\;\;\;t\_0\\
                        
                        \mathbf{elif}\;a \leq 1.2 \cdot 10^{+16}:\\
                        \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_0\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if a < -4e8 or 1.2e16 < a

                          1. Initial program 86.8%

                            \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                          2. Add Preprocessing
                          3. Step-by-step derivation
                            1. tan-quotN/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                            2. clear-numN/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                            3. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                            4. clear-numN/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                            5. tan-quotN/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\tan \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                            6. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \tan \left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                            7. tan-lowering-tan.f64N/A

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\left(y + z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                            8. +-lowering-+.f6486.8%

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          4. Applied egg-rr86.8%

                            \[\leadsto x + \left(\color{blue}{\frac{1}{\frac{1}{\tan \left(y + z\right)}}} - \tan a\right) \]
                          5. Taylor expanded in y around 0

                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\color{blue}{z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                          6. Step-by-step derivation
                            1. Simplified67.8%

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

                              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\color{blue}{z}, \mathsf{tan.f64}\left(a\right)\right)\right) \]
                            3. Step-by-step derivation
                              1. Simplified30.5%

                                \[\leadsto x + \left(\color{blue}{z} - \tan a\right) \]

                              if -4e8 < a < 1.2e16

                              1. Initial program 81.3%

                                \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                              2. Add Preprocessing
                              3. Taylor expanded in a around 0

                                \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
                              4. Step-by-step derivation
                                1. Simplified78.7%

                                  \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{a}\right) \]
                              5. Recombined 2 regimes into one program.
                              6. Add Preprocessing

                              Alternative 13: 45.4% accurate, 1.8× speedup?

                              \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x + \left(z - \tan a\right)\\ \mathbf{if}\;a \leq -400000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 1.2 \cdot 10^{+16}:\\ \;\;\;\;x + \left(\tan y - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                              NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                              (FPCore (x y z a)
                               :precision binary64
                               (let* ((t_0 (+ x (- z (tan a)))))
                                 (if (<= a -400000000.0) t_0 (if (<= a 1.2e+16) (+ x (- (tan y) a)) t_0))))
                              assert(x < y && y < z && z < a);
                              double code(double x, double y, double z, double a) {
                              	double t_0 = x + (z - tan(a));
                              	double tmp;
                              	if (a <= -400000000.0) {
                              		tmp = t_0;
                              	} else if (a <= 1.2e+16) {
                              		tmp = x + (tan(y) - a);
                              	} else {
                              		tmp = t_0;
                              	}
                              	return tmp;
                              }
                              
                              NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                              real(8) function code(x, y, z, a)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  real(8), intent (in) :: z
                                  real(8), intent (in) :: a
                                  real(8) :: t_0
                                  real(8) :: tmp
                                  t_0 = x + (z - tan(a))
                                  if (a <= (-400000000.0d0)) then
                                      tmp = t_0
                                  else if (a <= 1.2d+16) then
                                      tmp = x + (tan(y) - a)
                                  else
                                      tmp = t_0
                                  end if
                                  code = tmp
                              end function
                              
                              assert x < y && y < z && z < a;
                              public static double code(double x, double y, double z, double a) {
                              	double t_0 = x + (z - Math.tan(a));
                              	double tmp;
                              	if (a <= -400000000.0) {
                              		tmp = t_0;
                              	} else if (a <= 1.2e+16) {
                              		tmp = x + (Math.tan(y) - a);
                              	} else {
                              		tmp = t_0;
                              	}
                              	return tmp;
                              }
                              
                              [x, y, z, a] = sort([x, y, z, a])
                              def code(x, y, z, a):
                              	t_0 = x + (z - math.tan(a))
                              	tmp = 0
                              	if a <= -400000000.0:
                              		tmp = t_0
                              	elif a <= 1.2e+16:
                              		tmp = x + (math.tan(y) - a)
                              	else:
                              		tmp = t_0
                              	return tmp
                              
                              x, y, z, a = sort([x, y, z, a])
                              function code(x, y, z, a)
                              	t_0 = Float64(x + Float64(z - tan(a)))
                              	tmp = 0.0
                              	if (a <= -400000000.0)
                              		tmp = t_0;
                              	elseif (a <= 1.2e+16)
                              		tmp = Float64(x + Float64(tan(y) - a));
                              	else
                              		tmp = t_0;
                              	end
                              	return tmp
                              end
                              
                              x, y, z, a = num2cell(sort([x, y, z, a])){:}
                              function tmp_2 = code(x, y, z, a)
                              	t_0 = x + (z - tan(a));
                              	tmp = 0.0;
                              	if (a <= -400000000.0)
                              		tmp = t_0;
                              	elseif (a <= 1.2e+16)
                              		tmp = x + (tan(y) - a);
                              	else
                              		tmp = t_0;
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                              code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(z - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -400000000.0], t$95$0, If[LessEqual[a, 1.2e+16], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                              
                              \begin{array}{l}
                              [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                              \\
                              \begin{array}{l}
                              t_0 := x + \left(z - \tan a\right)\\
                              \mathbf{if}\;a \leq -400000000:\\
                              \;\;\;\;t\_0\\
                              
                              \mathbf{elif}\;a \leq 1.2 \cdot 10^{+16}:\\
                              \;\;\;\;x + \left(\tan y - a\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_0\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if a < -4e8 or 1.2e16 < a

                                1. Initial program 86.8%

                                  \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. tan-quotN/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                  2. clear-numN/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                  3. /-lowering-/.f64N/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                  4. clear-numN/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                  5. tan-quotN/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\tan \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                  6. /-lowering-/.f64N/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \tan \left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                  7. tan-lowering-tan.f64N/A

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\left(y + z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                  8. +-lowering-+.f6486.8%

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                4. Applied egg-rr86.8%

                                  \[\leadsto x + \left(\color{blue}{\frac{1}{\frac{1}{\tan \left(y + z\right)}}} - \tan a\right) \]
                                5. Taylor expanded in y around 0

                                  \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\color{blue}{z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                6. Step-by-step derivation
                                  1. Simplified67.8%

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

                                    \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\color{blue}{z}, \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                  3. Step-by-step derivation
                                    1. Simplified30.5%

                                      \[\leadsto x + \left(\color{blue}{z} - \tan a\right) \]

                                    if -4e8 < a < 1.2e16

                                    1. Initial program 81.3%

                                      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in a around 0

                                      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
                                    4. Step-by-step derivation
                                      1. Simplified78.7%

                                        \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{a}\right) \]
                                      2. Taylor expanded in y around inf

                                        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{y}\right), a\right)\right) \]
                                      3. Step-by-step derivation
                                        1. Simplified59.2%

                                          \[\leadsto x + \left(\tan \color{blue}{y} - a\right) \]
                                      4. Recombined 2 regimes into one program.
                                      5. Add Preprocessing

                                      Alternative 14: 40.1% accurate, 1.9× speedup?

                                      \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 0.043:\\ \;\;\;\;x + \left(z - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                                      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                      (FPCore (x y z a) :precision binary64 (if (<= z 0.043) (+ x (- z (tan a))) x))
                                      assert(x < y && y < z && z < a);
                                      double code(double x, double y, double z, double a) {
                                      	double tmp;
                                      	if (z <= 0.043) {
                                      		tmp = x + (z - tan(a));
                                      	} else {
                                      		tmp = x;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                      real(8) function code(x, y, z, a)
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          real(8), intent (in) :: z
                                          real(8), intent (in) :: a
                                          real(8) :: tmp
                                          if (z <= 0.043d0) then
                                              tmp = x + (z - tan(a))
                                          else
                                              tmp = x
                                          end if
                                          code = tmp
                                      end function
                                      
                                      assert x < y && y < z && z < a;
                                      public static double code(double x, double y, double z, double a) {
                                      	double tmp;
                                      	if (z <= 0.043) {
                                      		tmp = x + (z - Math.tan(a));
                                      	} else {
                                      		tmp = x;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      [x, y, z, a] = sort([x, y, z, a])
                                      def code(x, y, z, a):
                                      	tmp = 0
                                      	if z <= 0.043:
                                      		tmp = x + (z - math.tan(a))
                                      	else:
                                      		tmp = x
                                      	return tmp
                                      
                                      x, y, z, a = sort([x, y, z, a])
                                      function code(x, y, z, a)
                                      	tmp = 0.0
                                      	if (z <= 0.043)
                                      		tmp = Float64(x + Float64(z - tan(a)));
                                      	else
                                      		tmp = x;
                                      	end
                                      	return tmp
                                      end
                                      
                                      x, y, z, a = num2cell(sort([x, y, z, a])){:}
                                      function tmp_2 = code(x, y, z, a)
                                      	tmp = 0.0;
                                      	if (z <= 0.043)
                                      		tmp = x + (z - tan(a));
                                      	else
                                      		tmp = x;
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                      code[x_, y_, z_, a_] := If[LessEqual[z, 0.043], N[(x + N[(z - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
                                      
                                      \begin{array}{l}
                                      [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;z \leq 0.043:\\
                                      \;\;\;\;x + \left(z - \tan a\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;x\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if z < 0.042999999999999997

                                        1. Initial program 88.4%

                                          \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                                        2. Add Preprocessing
                                        3. Step-by-step derivation
                                          1. tan-quotN/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                          2. clear-numN/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                          3. /-lowering-/.f64N/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(\color{blue}{a}\right)\right)\right) \]
                                          4. clear-numN/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                          5. tan-quotN/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\tan \left(y + z\right)}\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                          6. /-lowering-/.f64N/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \tan \left(y + z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                          7. tan-lowering-tan.f64N/A

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\left(y + z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                          8. +-lowering-+.f6488.4%

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                        4. Applied egg-rr88.4%

                                          \[\leadsto x + \left(\color{blue}{\frac{1}{\frac{1}{\tan \left(y + z\right)}}} - \tan a\right) \]
                                        5. Taylor expanded in y around 0

                                          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\color{blue}{z}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                        6. Step-by-step derivation
                                          1. Simplified63.6%

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

                                            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\color{blue}{z}, \mathsf{tan.f64}\left(a\right)\right)\right) \]
                                          3. Step-by-step derivation
                                            1. Simplified40.2%

                                              \[\leadsto x + \left(\color{blue}{z} - \tan a\right) \]

                                            if 0.042999999999999997 < z

                                            1. Initial program 69.6%

                                              \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in x around inf

                                              \[\leadsto \color{blue}{x} \]
                                            4. Step-by-step derivation
                                              1. Simplified23.3%

                                                \[\leadsto \color{blue}{x} \]
                                            5. Recombined 2 regimes into one program.
                                            6. Add Preprocessing

                                            Alternative 15: 31.5% accurate, 207.0× speedup?

                                            \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x \end{array} \]
                                            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                            (FPCore (x y z a) :precision binary64 x)
                                            assert(x < y && y < z && z < a);
                                            double code(double x, double y, double z, double a) {
                                            	return x;
                                            }
                                            
                                            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                            real(8) function code(x, y, z, a)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                real(8), intent (in) :: z
                                                real(8), intent (in) :: a
                                                code = x
                                            end function
                                            
                                            assert x < y && y < z && z < a;
                                            public static double code(double x, double y, double z, double a) {
                                            	return x;
                                            }
                                            
                                            [x, y, z, a] = sort([x, y, z, a])
                                            def code(x, y, z, a):
                                            	return x
                                            
                                            x, y, z, a = sort([x, y, z, a])
                                            function code(x, y, z, a)
                                            	return x
                                            end
                                            
                                            x, y, z, a = num2cell(sort([x, y, z, a])){:}
                                            function tmp = code(x, y, z, a)
                                            	tmp = x;
                                            end
                                            
                                            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                                            code[x_, y_, z_, a_] := x
                                            
                                            \begin{array}{l}
                                            [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                                            \\
                                            x
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 83.7%

                                              \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in x around inf

                                              \[\leadsto \color{blue}{x} \]
                                            4. Step-by-step derivation
                                              1. Simplified33.2%

                                                \[\leadsto \color{blue}{x} \]
                                              2. Add Preprocessing

                                              Reproduce

                                              ?
                                              herbie shell --seed 2024161 
                                              (FPCore (x y z a)
                                                :name "tan-example (used to crash)"
                                                :precision binary64
                                                :pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
                                                (+ x (- (tan (+ y z)) (tan a))))