tan-example (used to crash)

Percentage Accurate: 78.7% → 99.7%
Time: 30.9s
Alternatives: 14
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 14 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: 78.7% 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])\\ \\ \left(\frac{\mathsf{fma}\left(\sin z, \frac{1}{\cos z}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) + 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
 (+
  (-
   (/ (fma (sin z) (/ 1.0 (cos z)) (tan y)) (fma (- (tan z)) (tan y) 1.0))
   (tan a))
  x))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	return ((fma(sin(z), (1.0 / cos(z)), tan(y)) / fma(-tan(z), tan(y), 1.0)) - tan(a)) + x;
}
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	return Float64(Float64(Float64(fma(sin(z), Float64(1.0 / cos(z)), tan(y)) / fma(Float64(-tan(z)), tan(y), 1.0)) - tan(a)) + x)
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := N[(N[(N[(N[(N[Sin[z], $MachinePrecision] * N[(1.0 / N[Cos[z], $MachinePrecision]), $MachinePrecision] + N[Tan[y], $MachinePrecision]), $MachinePrecision] / N[((-N[Tan[z], $MachinePrecision]) * N[Tan[y], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\left(\frac{\mathsf{fma}\left(\sin z, \frac{1}{\cos z}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) + x
\end{array}
Derivation
  1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\frac{\tan z + \tan y}{\left(\mathsf{neg}\left(\color{blue}{\tan z \cdot \tan y}\right)\right) + 1} - \tan a\right) \]
    12. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\frac{\mathsf{fma}\left(\color{blue}{\sin z}, \frac{1}{\cos z}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) \]
    7. inv-powN/A

      \[\leadsto x + \left(\frac{\mathsf{fma}\left(\sin z, \color{blue}{{\cos z}^{-1}}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) \]
    8. lower-pow.f64N/A

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

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

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

      \[\leadsto x + \left(\frac{\mathsf{fma}\left(\sin z, \color{blue}{{\cos z}^{-1}}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) \]
    2. unpow-1N/A

      \[\leadsto x + \left(\frac{\mathsf{fma}\left(\sin z, \color{blue}{\frac{1}{\cos z}}, \tan y\right)}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)} - \tan a\right) \]
    3. lower-/.f6499.7

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

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

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

Alternative 2: 88.4% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := -\tan z\\ t_1 := t\_0 - \tan y\\ \mathbf{if}\;\tan a \leq -0.0002:\\ \;\;\;\;\left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\tan a}}\right) + x\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-43}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, \frac{-1}{\mathsf{fma}\left(t\_0, \tan y, 1\right)}, x - a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, -1, x - \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 z))) (t_1 (- t_0 (tan y))))
   (if (<= (tan a) -0.0002)
     (+ (- (tan (+ y z)) (/ 1.0 (/ 1.0 (tan a)))) x)
     (if (<= (tan a) 5e-43)
       (fma t_1 (/ -1.0 (fma t_0 (tan y) 1.0)) (- x a))
       (fma t_1 -1.0 (- x (tan a)))))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double t_0 = -tan(z);
	double t_1 = t_0 - tan(y);
	double tmp;
	if (tan(a) <= -0.0002) {
		tmp = (tan((y + z)) - (1.0 / (1.0 / tan(a)))) + x;
	} else if (tan(a) <= 5e-43) {
		tmp = fma(t_1, (-1.0 / fma(t_0, tan(y), 1.0)), (x - a));
	} else {
		tmp = fma(t_1, -1.0, (x - tan(a)));
	}
	return tmp;
}
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	t_0 = Float64(-tan(z))
	t_1 = Float64(t_0 - tan(y))
	tmp = 0.0
	if (tan(a) <= -0.0002)
		tmp = Float64(Float64(tan(Float64(y + z)) - Float64(1.0 / Float64(1.0 / tan(a)))) + x);
	elseif (tan(a) <= 5e-43)
		tmp = fma(t_1, Float64(-1.0 / fma(t_0, tan(y), 1.0)), Float64(x - a));
	else
		tmp = fma(t_1, -1.0, Float64(x - tan(a)));
	end
	return 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[Tan[z], $MachinePrecision])}, Block[{t$95$1 = N[(t$95$0 - N[Tan[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.0002], N[(N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(1.0 / N[(1.0 / N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-43], N[(t$95$1 * N[(-1.0 / N[(t$95$0 * N[Tan[y], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x - a), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * -1.0 + N[(x - 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 z\\
t_1 := t\_0 - \tan y\\
\mathbf{if}\;\tan a \leq -0.0002:\\
\;\;\;\;\left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\tan a}}\right) + x\\

\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{-1}{\mathsf{fma}\left(t\_0, \tan y, 1\right)}, x - a\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -1, x - \tan a\right)\\


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

    1. Initial program 81.5%

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

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

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

        \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\frac{1}{\frac{\cos a}{\sin a}}}\right) \]
      4. lower-/.f64N/A

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

        \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\color{blue}{\frac{1}{\frac{\sin a}{\cos a}}}}\right) \]
      6. tan-quotN/A

        \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\color{blue}{\tan a}}}\right) \]
      7. lift-tan.f64N/A

        \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\color{blue}{\tan a}}}\right) \]
      8. lower-/.f6481.5

        \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\color{blue}{\frac{1}{\tan a}}}\right) \]
    4. Applied rewrites81.5%

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

    if -2.0000000000000001e-4 < (tan.f64 a) < 5.00000000000000019e-43

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(\tan y + \tan z\right)\right), \frac{1}{\mathsf{neg}\left(\left(1 - \tan y \cdot \tan z\right)\right)}, x - \tan a\right)} \]
    4. Applied rewrites99.7%

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

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

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

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

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

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

    if 5.00000000000000019e-43 < (tan.f64 a)

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(\tan y + \tan z\right)\right), \frac{1}{\mathsf{neg}\left(\left(1 - \tan y \cdot \tan z\right)\right)}, x - \tan a\right)} \]
    4. Applied rewrites99.6%

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

      \[\leadsto \mathsf{fma}\left(-\left(\tan z + \tan y\right), \color{blue}{-1}, x - \tan a\right) \]
    6. Step-by-step derivation
      1. Applied rewrites86.1%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -0.0002:\\ \;\;\;\;\left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\tan a}}\right) + x\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-43}:\\ \;\;\;\;\mathsf{fma}\left(\left(-\tan z\right) - \tan y, \frac{-1}{\mathsf{fma}\left(-\tan z, \tan y, 1\right)}, x - a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-\tan z\right) - \tan y, -1, x - \tan a\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 99.7% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\frac{\tan z + \tan y}{\left(\mathsf{neg}\left(\color{blue}{\tan z \cdot \tan y}\right)\right) + 1} - \tan a\right) \]
      12. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

    Alternative 4: 58.8% accurate, 0.7× speedup?

    \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x - \tan a\\ \mathbf{if}\;\tan a \leq -0.175:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-13}:\\ \;\;\;\;\tan \left(y + z\right) - \left(-x\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 a))))
       (if (<= (tan a) -0.175)
         t_0
         (if (<= (tan a) 2e-13) (- (tan (+ y z)) (- x)) t_0))))
    assert(x < y && y < z && z < a);
    double code(double x, double y, double z, double a) {
    	double t_0 = x - tan(a);
    	double tmp;
    	if (tan(a) <= -0.175) {
    		tmp = t_0;
    	} else if (tan(a) <= 2e-13) {
    		tmp = tan((y + z)) - -x;
    	} 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(a)
        if (tan(a) <= (-0.175d0)) then
            tmp = t_0
        else if (tan(a) <= 2d-13) then
            tmp = tan((y + z)) - -x
        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(a);
    	double tmp;
    	if (Math.tan(a) <= -0.175) {
    		tmp = t_0;
    	} else if (Math.tan(a) <= 2e-13) {
    		tmp = Math.tan((y + z)) - -x;
    	} 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(a)
    	tmp = 0
    	if math.tan(a) <= -0.175:
    		tmp = t_0
    	elif math.tan(a) <= 2e-13:
    		tmp = math.tan((y + z)) - -x
    	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 - tan(a))
    	tmp = 0.0
    	if (tan(a) <= -0.175)
    		tmp = t_0;
    	elseif (tan(a) <= 2e-13)
    		tmp = Float64(tan(Float64(y + z)) - Float64(-x));
    	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(a);
    	tmp = 0.0;
    	if (tan(a) <= -0.175)
    		tmp = t_0;
    	elseif (tan(a) <= 2e-13)
    		tmp = tan((y + z)) - -x;
    	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[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.175], t$95$0, If[LessEqual[N[Tan[a], $MachinePrecision], 2e-13], N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - (-x)), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
    \\
    \begin{array}{l}
    t_0 := x - \tan a\\
    \mathbf{if}\;\tan a \leq -0.175:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-13}:\\
    \;\;\;\;\tan \left(y + z\right) - \left(-x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (tan.f64 a) < -0.17499999999999999 or 2.0000000000000001e-13 < (tan.f64 a)

      1. Initial program 82.0%

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

        \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
      4. Step-by-step derivation
        1. lower--.f64N/A

          \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
        3. lower-+.f64N/A

          \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
        4. lower-/.f64N/A

          \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
        5. lower-sin.f64N/A

          \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
        6. lower-cos.f64N/A

          \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
        7. lower-/.f64N/A

          \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
        8. lower-sin.f64N/A

          \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
        9. lower-cos.f6460.1

          \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
      5. Applied rewrites60.1%

        \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
      6. Taylor expanded in y around 0

        \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
      7. Step-by-step derivation
        1. Applied rewrites41.9%

          \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
        2. Step-by-step derivation
          1. Applied rewrites41.9%

            \[\leadsto \color{blue}{x - \tan a} \]

          if -0.17499999999999999 < (tan.f64 a) < 2.0000000000000001e-13

          1. Initial program 78.4%

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

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

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

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

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

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

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

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

              \[\leadsto \tan \color{blue}{\left(z + y\right)} - \left(\tan a - x\right) \]
            9. lower--.f6478.3

              \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\tan a - x\right)} \]
          4. Applied rewrites78.3%

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

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

              \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \]
            2. lower-neg.f6476.0

              \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(-x\right)} \]
          7. Applied rewrites76.0%

            \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(-x\right)} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification59.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -0.175:\\ \;\;\;\;x - \tan a\\ \mathbf{elif}\;\tan a \leq 2 \cdot 10^{-13}:\\ \;\;\;\;\tan \left(y + z\right) - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \tan a\\ \end{array} \]
        5. Add Preprocessing

        Alternative 5: 79.1% accurate, 0.7× speedup?

        \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \mathsf{fma}\left(\left(-\tan z\right) - \tan y, -1, x - \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
         (fma (- (- (tan z)) (tan y)) -1.0 (- x (tan a))))
        assert(x < y && y < z && z < a);
        double code(double x, double y, double z, double a) {
        	return fma((-tan(z) - tan(y)), -1.0, (x - tan(a)));
        }
        
        x, y, z, a = sort([x, y, z, a])
        function code(x, y, z, a)
        	return fma(Float64(Float64(-tan(z)) - tan(y)), -1.0, Float64(x - 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[(N[((-N[Tan[z], $MachinePrecision]) - N[Tan[y], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
        \\
        \mathsf{fma}\left(\left(-\tan z\right) - \tan y, -1, x - \tan a\right)
        \end{array}
        
        Derivation
        1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(\tan y + \tan z\right)\right), \frac{1}{\mathsf{neg}\left(\left(1 - \tan y \cdot \tan z\right)\right)}, x - \tan a\right)} \]
        4. Applied rewrites99.6%

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

          \[\leadsto \mathsf{fma}\left(-\left(\tan z + \tan y\right), \color{blue}{-1}, x - \tan a\right) \]
        6. Step-by-step derivation
          1. Applied rewrites80.7%

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

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

          Alternative 6: 78.7% accurate, 0.9× speedup?

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

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

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

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

              \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\frac{1}{\frac{\cos a}{\sin a}}}\right) \]
            4. lower-/.f64N/A

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

              \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\color{blue}{\frac{1}{\frac{\sin a}{\cos a}}}}\right) \]
            6. tan-quotN/A

              \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\color{blue}{\tan a}}}\right) \]
            7. lift-tan.f64N/A

              \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{\frac{1}{\color{blue}{\tan a}}}\right) \]
            8. lower-/.f6480.2

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

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

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

          Alternative 7: 68.2% 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 10^{-12}:\\ \;\;\;\;\left(\tan y - \tan a\right) + x\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) - \left(-x\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) 1e-12) (+ (- (tan y) (tan a)) x) (- (tan (+ y z)) (- x))))
          assert(x < y && y < z && z < a);
          double code(double x, double y, double z, double a) {
          	double tmp;
          	if ((y + z) <= 1e-12) {
          		tmp = (tan(y) - tan(a)) + x;
          	} else {
          		tmp = tan((y + z)) - -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 ((y + z) <= 1d-12) then
                  tmp = (tan(y) - tan(a)) + x
              else
                  tmp = tan((y + z)) - -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 ((y + z) <= 1e-12) {
          		tmp = (Math.tan(y) - Math.tan(a)) + x;
          	} else {
          		tmp = Math.tan((y + z)) - -x;
          	}
          	return tmp;
          }
          
          [x, y, z, a] = sort([x, y, z, a])
          def code(x, y, z, a):
          	tmp = 0
          	if (y + z) <= 1e-12:
          		tmp = (math.tan(y) - math.tan(a)) + x
          	else:
          		tmp = math.tan((y + z)) - -x
          	return tmp
          
          x, y, z, a = sort([x, y, z, a])
          function code(x, y, z, a)
          	tmp = 0.0
          	if (Float64(y + z) <= 1e-12)
          		tmp = Float64(Float64(tan(y) - tan(a)) + x);
          	else
          		tmp = Float64(tan(Float64(y + z)) - Float64(-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 ((y + z) <= 1e-12)
          		tmp = (tan(y) - tan(a)) + x;
          	else
          		tmp = tan((y + z)) - -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[N[(y + z), $MachinePrecision], 1e-12], N[(N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - (-x)), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;y + z \leq 10^{-12}:\\
          \;\;\;\;\left(\tan y - \tan a\right) + x\\
          
          \mathbf{else}:\\
          \;\;\;\;\tan \left(y + z\right) - \left(-x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 y z) < 9.9999999999999998e-13

            1. Initial program 84.9%

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

              \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
            4. Step-by-step derivation
              1. lower--.f64N/A

                \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
              2. +-commutativeN/A

                \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
              3. lower-+.f64N/A

                \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
              4. lower-/.f64N/A

                \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
              5. lower-sin.f64N/A

                \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
              6. lower-cos.f64N/A

                \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
              7. lower-/.f64N/A

                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
              8. lower-sin.f64N/A

                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
              9. lower-cos.f6465.7

                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
            5. Applied rewrites65.7%

              \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
            6. Step-by-step derivation
              1. Applied rewrites65.7%

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

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

              1. Initial program 73.0%

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

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

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

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

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

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

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

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

                  \[\leadsto \tan \color{blue}{\left(z + y\right)} - \left(\tan a - x\right) \]
                9. lower--.f6472.8

                  \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\tan a - x\right)} \]
              4. Applied rewrites72.8%

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

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

                  \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \]
                2. lower-neg.f6449.4

                  \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(-x\right)} \]
              7. Applied rewrites49.4%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y + z \leq 10^{-12}:\\ \;\;\;\;\left(\tan y - \tan a\right) + x\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) - \left(-x\right)\\ \end{array} \]
            9. Add Preprocessing

            Alternative 8: 78.7% accurate, 1.0× speedup?

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

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

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

            Alternative 9: 59.7% accurate, 1.5× speedup?

            \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x - \tan a\\ \mathbf{if}\;a \leq -0.085:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 17:\\ \;\;\;\;\tan \left(y + z\right) - \left(\mathsf{fma}\left(0.3333333333333333, a \cdot a, 1\right) \cdot a - x\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 a))))
               (if (<= a -0.085)
                 t_0
                 (if (<= a 17.0)
                   (- (tan (+ y z)) (- (* (fma 0.3333333333333333 (* a a) 1.0) a) x))
                   t_0))))
            assert(x < y && y < z && z < a);
            double code(double x, double y, double z, double a) {
            	double t_0 = x - tan(a);
            	double tmp;
            	if (a <= -0.085) {
            		tmp = t_0;
            	} else if (a <= 17.0) {
            		tmp = tan((y + z)) - ((fma(0.3333333333333333, (a * a), 1.0) * a) - x);
            	} 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 - tan(a))
            	tmp = 0.0
            	if (a <= -0.085)
            		tmp = t_0;
            	elseif (a <= 17.0)
            		tmp = Float64(tan(Float64(y + z)) - Float64(Float64(fma(0.3333333333333333, Float64(a * a), 1.0) * a) - x));
            	else
            		tmp = t_0;
            	end
            	return 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[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.085], t$95$0, If[LessEqual[a, 17.0], N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[(N[(0.3333333333333333 * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
            \\
            \begin{array}{l}
            t_0 := x - \tan a\\
            \mathbf{if}\;a \leq -0.085:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;a \leq 17:\\
            \;\;\;\;\tan \left(y + z\right) - \left(\mathsf{fma}\left(0.3333333333333333, a \cdot a, 1\right) \cdot a - x\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if a < -0.0850000000000000061 or 17 < a

              1. Initial program 82.1%

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

                \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
              4. Step-by-step derivation
                1. lower--.f64N/A

                  \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                2. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                3. lower-+.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                4. lower-/.f64N/A

                  \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                5. lower-sin.f64N/A

                  \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
                6. lower-cos.f64N/A

                  \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                7. lower-/.f64N/A

                  \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                8. lower-sin.f64N/A

                  \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                9. lower-cos.f6460.4

                  \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
              5. Applied rewrites60.4%

                \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
              6. Taylor expanded in y around 0

                \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
              7. Step-by-step derivation
                1. Applied rewrites41.4%

                  \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                2. Step-by-step derivation
                  1. Applied rewrites41.4%

                    \[\leadsto \color{blue}{x - \tan a} \]

                  if -0.0850000000000000061 < a < 17

                  1. Initial program 78.2%

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

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

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

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

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

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

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

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

                      \[\leadsto \tan \color{blue}{\left(z + y\right)} - \left(\tan a - x\right) \]
                    9. lower--.f6478.2

                      \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\tan a - x\right)} \]
                  4. Applied rewrites78.2%

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

                    \[\leadsto \tan \left(z + y\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                  6. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \tan \left(z + y\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                    2. lower-sin.f64N/A

                      \[\leadsto \tan \left(z + y\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                    3. lower-cos.f648.4

                      \[\leadsto \tan \left(z + y\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                  7. Applied rewrites8.4%

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

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

                      \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(a \cdot \left(1 + \frac{1}{3} \cdot {a}^{2}\right) - x\right)} \]
                    2. *-commutativeN/A

                      \[\leadsto \tan \left(z + y\right) - \left(\color{blue}{\left(1 + \frac{1}{3} \cdot {a}^{2}\right) \cdot a} - x\right) \]
                    3. lower-*.f64N/A

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

                      \[\leadsto \tan \left(z + y\right) - \left(\color{blue}{\left(\frac{1}{3} \cdot {a}^{2} + 1\right)} \cdot a - x\right) \]
                    5. lower-fma.f64N/A

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

                      \[\leadsto \tan \left(z + y\right) - \left(\mathsf{fma}\left(\frac{1}{3}, \color{blue}{a \cdot a}, 1\right) \cdot a - x\right) \]
                    7. lower-*.f6477.5

                      \[\leadsto \tan \left(z + y\right) - \left(\mathsf{fma}\left(0.3333333333333333, \color{blue}{a \cdot a}, 1\right) \cdot a - x\right) \]
                  10. Applied rewrites77.5%

                    \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, a \cdot a, 1\right) \cdot a - x\right)} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification59.5%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.085:\\ \;\;\;\;x - \tan a\\ \mathbf{elif}\;a \leq 17:\\ \;\;\;\;\tan \left(y + z\right) - \left(\mathsf{fma}\left(0.3333333333333333, a \cdot a, 1\right) \cdot a - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \tan a\\ \end{array} \]
                5. Add Preprocessing

                Alternative 10: 59.6% accurate, 1.7× speedup?

                \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := x - \tan a\\ \mathbf{if}\;a \leq -0.035:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 17:\\ \;\;\;\;\tan \left(y + z\right) - \left(a - x\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 a))))
                   (if (<= a -0.035) t_0 (if (<= a 17.0) (- (tan (+ y z)) (- a x)) t_0))))
                assert(x < y && y < z && z < a);
                double code(double x, double y, double z, double a) {
                	double t_0 = x - tan(a);
                	double tmp;
                	if (a <= -0.035) {
                		tmp = t_0;
                	} else if (a <= 17.0) {
                		tmp = tan((y + z)) - (a - x);
                	} 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(a)
                    if (a <= (-0.035d0)) then
                        tmp = t_0
                    else if (a <= 17.0d0) then
                        tmp = tan((y + z)) - (a - x)
                    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(a);
                	double tmp;
                	if (a <= -0.035) {
                		tmp = t_0;
                	} else if (a <= 17.0) {
                		tmp = Math.tan((y + z)) - (a - x);
                	} 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(a)
                	tmp = 0
                	if a <= -0.035:
                		tmp = t_0
                	elif a <= 17.0:
                		tmp = math.tan((y + z)) - (a - x)
                	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 - tan(a))
                	tmp = 0.0
                	if (a <= -0.035)
                		tmp = t_0;
                	elseif (a <= 17.0)
                		tmp = Float64(tan(Float64(y + z)) - Float64(a - x));
                	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(a);
                	tmp = 0.0;
                	if (a <= -0.035)
                		tmp = t_0;
                	elseif (a <= 17.0)
                		tmp = tan((y + z)) - (a - x);
                	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[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.035], t$95$0, If[LessEqual[a, 17.0], N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(a - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                \\
                \begin{array}{l}
                t_0 := x - \tan a\\
                \mathbf{if}\;a \leq -0.035:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;a \leq 17:\\
                \;\;\;\;\tan \left(y + z\right) - \left(a - x\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if a < -0.035000000000000003 or 17 < a

                  1. Initial program 82.1%

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

                    \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                  4. Step-by-step derivation
                    1. lower--.f64N/A

                      \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                    2. +-commutativeN/A

                      \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                    3. lower-+.f64N/A

                      \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                    4. lower-/.f64N/A

                      \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                    5. lower-sin.f64N/A

                      \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
                    6. lower-cos.f64N/A

                      \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                    7. lower-/.f64N/A

                      \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                    8. lower-sin.f64N/A

                      \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                    9. lower-cos.f6460.4

                      \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                  5. Applied rewrites60.4%

                    \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
                  6. Taylor expanded in y around 0

                    \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                  7. Step-by-step derivation
                    1. Applied rewrites41.4%

                      \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                    2. Step-by-step derivation
                      1. Applied rewrites41.4%

                        \[\leadsto \color{blue}{x - \tan a} \]

                      if -0.035000000000000003 < a < 17

                      1. Initial program 78.2%

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

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

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

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

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

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

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

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

                          \[\leadsto \tan \color{blue}{\left(z + y\right)} - \left(\tan a - x\right) \]
                        9. lower--.f6478.2

                          \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(\tan a - x\right)} \]
                      4. Applied rewrites78.2%

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

                        \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(a - x\right)} \]
                      6. Step-by-step derivation
                        1. lower--.f6477.4

                          \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(a - x\right)} \]
                      7. Applied rewrites77.4%

                        \[\leadsto \tan \left(z + y\right) - \color{blue}{\left(a - x\right)} \]
                    3. Recombined 2 regimes into one program.
                    4. Final simplification59.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.035:\\ \;\;\;\;x - \tan a\\ \mathbf{elif}\;a \leq 17:\\ \;\;\;\;\tan \left(y + z\right) - \left(a - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - \tan a\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 11: 41.2% accurate, 2.0× speedup?

                    \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x - \tan a \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 a)))
                    assert(x < y && y < z && z < a);
                    double code(double x, double y, double z, double a) {
                    	return x - 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(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(a);
                    }
                    
                    [x, y, z, a] = sort([x, y, z, a])
                    def code(x, y, z, a):
                    	return x - math.tan(a)
                    
                    x, y, z, a = sort([x, y, z, a])
                    function code(x, y, z, a)
                    	return Float64(x - tan(a))
                    end
                    
                    x, y, z, a = num2cell(sort([x, y, z, a])){:}
                    function tmp = code(x, y, z, a)
                    	tmp = x - 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[Tan[a], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                    \\
                    x - \tan a
                    \end{array}
                    
                    Derivation
                    1. Initial program 80.2%

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

                      \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                    4. Step-by-step derivation
                      1. lower--.f64N/A

                        \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                      2. +-commutativeN/A

                        \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                      3. lower-+.f64N/A

                        \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                      4. lower-/.f64N/A

                        \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                      5. lower-sin.f64N/A

                        \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
                      6. lower-cos.f64N/A

                        \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                      7. lower-/.f64N/A

                        \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                      8. lower-sin.f64N/A

                        \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                      9. lower-cos.f6460.4

                        \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                    5. Applied rewrites60.4%

                      \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
                    6. Taylor expanded in y around 0

                      \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                    7. Step-by-step derivation
                      1. Applied rewrites39.4%

                        \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites39.4%

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

                        Alternative 12: 31.6% accurate, 9.1× speedup?

                        \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \frac{1}{\frac{1}{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 (/ 1.0 (/ 1.0 x)))
                        assert(x < y && y < z && z < a);
                        double code(double x, double y, double z, double a) {
                        	return 1.0 / (1.0 / 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 = 1.0d0 / (1.0d0 / x)
                        end function
                        
                        assert x < y && y < z && z < a;
                        public static double code(double x, double y, double z, double a) {
                        	return 1.0 / (1.0 / x);
                        }
                        
                        [x, y, z, a] = sort([x, y, z, a])
                        def code(x, y, z, a):
                        	return 1.0 / (1.0 / x)
                        
                        x, y, z, a = sort([x, y, z, a])
                        function code(x, y, z, a)
                        	return Float64(1.0 / Float64(1.0 / x))
                        end
                        
                        x, y, z, a = num2cell(sort([x, y, z, a])){:}
                        function tmp = code(x, y, z, a)
                        	tmp = 1.0 / (1.0 / x);
                        end
                        
                        NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                        code[x_, y_, z_, a_] := N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
                        
                        \begin{array}{l}
                        [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                        \\
                        \frac{1}{\frac{1}{x}}
                        \end{array}
                        
                        Derivation
                        1. Initial program 80.2%

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

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

                            \[\leadsto \color{blue}{\frac{{x}^{3} + {\left(\tan \left(y + z\right) - \tan a\right)}^{3}}{x \cdot x + \left(\left(\tan \left(y + z\right) - \tan a\right) \cdot \left(\tan \left(y + z\right) - \tan a\right) - x \cdot \left(\tan \left(y + z\right) - \tan a\right)\right)}} \]
                          3. clear-numN/A

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

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

                            \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{{x}^{3} + {\left(\tan \left(y + z\right) - \tan a\right)}^{3}}{x \cdot x + \left(\left(\tan \left(y + z\right) - \tan a\right) \cdot \left(\tan \left(y + z\right) - \tan a\right) - x \cdot \left(\tan \left(y + z\right) - \tan a\right)\right)}}}} \]
                          6. flip3-+N/A

                            \[\leadsto \frac{1}{\frac{1}{\color{blue}{x + \left(\tan \left(y + z\right) - \tan a\right)}}} \]
                          7. lift-+.f64N/A

                            \[\leadsto \frac{1}{\frac{1}{\color{blue}{x + \left(\tan \left(y + z\right) - \tan a\right)}}} \]
                          8. lower-/.f6480.0

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

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

                          \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
                        6. Step-by-step derivation
                          1. lower-/.f6429.6

                            \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
                        7. Applied rewrites29.6%

                          \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
                        8. Add Preprocessing

                        Alternative 13: 22.5% accurate, 52.5× speedup?

                        \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x - a \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 a))
                        assert(x < y && y < z && z < a);
                        double code(double x, double y, double z, double a) {
                        	return x - 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 - a
                        end function
                        
                        assert x < y && y < z && z < a;
                        public static double code(double x, double y, double z, double a) {
                        	return x - a;
                        }
                        
                        [x, y, z, a] = sort([x, y, z, a])
                        def code(x, y, z, a):
                        	return x - a
                        
                        x, y, z, a = sort([x, y, z, a])
                        function code(x, y, z, a)
                        	return Float64(x - a)
                        end
                        
                        x, y, z, a = num2cell(sort([x, y, z, a])){:}
                        function tmp = code(x, y, z, a)
                        	tmp = x - 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 - a), $MachinePrecision]
                        
                        \begin{array}{l}
                        [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                        \\
                        x - a
                        \end{array}
                        
                        Derivation
                        1. Initial program 80.2%

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

                          \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                        4. Step-by-step derivation
                          1. lower--.f64N/A

                            \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                          2. +-commutativeN/A

                            \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                          3. lower-+.f64N/A

                            \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                          4. lower-/.f64N/A

                            \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                          5. lower-sin.f64N/A

                            \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
                          6. lower-cos.f64N/A

                            \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                          7. lower-/.f64N/A

                            \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                          8. lower-sin.f64N/A

                            \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                          9. lower-cos.f6460.4

                            \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                        5. Applied rewrites60.4%

                          \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
                        6. Taylor expanded in y around 0

                          \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                        7. Step-by-step derivation
                          1. Applied rewrites39.4%

                            \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                          2. Taylor expanded in a around 0

                            \[\leadsto x + -1 \cdot \color{blue}{a} \]
                          3. Step-by-step derivation
                            1. Applied rewrites20.5%

                              \[\leadsto x - a \]
                            2. Add Preprocessing

                            Alternative 14: 3.5% accurate, 70.0× speedup?

                            \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ -a \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 (- a))
                            assert(x < y && y < z && z < a);
                            double code(double x, double y, double z, double a) {
                            	return -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 = -a
                            end function
                            
                            assert x < y && y < z && z < a;
                            public static double code(double x, double y, double z, double a) {
                            	return -a;
                            }
                            
                            [x, y, z, a] = sort([x, y, z, a])
                            def code(x, y, z, a):
                            	return -a
                            
                            x, y, z, a = sort([x, y, z, a])
                            function code(x, y, z, a)
                            	return Float64(-a)
                            end
                            
                            x, y, z, a = num2cell(sort([x, y, z, a])){:}
                            function tmp = code(x, y, z, a)
                            	tmp = -a;
                            end
                            
                            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
                            code[x_, y_, z_, a_] := (-a)
                            
                            \begin{array}{l}
                            [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
                            \\
                            -a
                            \end{array}
                            
                            Derivation
                            1. Initial program 80.2%

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

                              \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                            4. Step-by-step derivation
                              1. lower--.f64N/A

                                \[\leadsto \color{blue}{\left(x + \frac{\sin y}{\cos y}\right) - \frac{\sin a}{\cos a}} \]
                              2. +-commutativeN/A

                                \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                              3. lower-+.f64N/A

                                \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right)} - \frac{\sin a}{\cos a} \]
                              4. lower-/.f64N/A

                                \[\leadsto \left(\color{blue}{\frac{\sin y}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                              5. lower-sin.f64N/A

                                \[\leadsto \left(\frac{\color{blue}{\sin y}}{\cos y} + x\right) - \frac{\sin a}{\cos a} \]
                              6. lower-cos.f64N/A

                                \[\leadsto \left(\frac{\sin y}{\color{blue}{\cos y}} + x\right) - \frac{\sin a}{\cos a} \]
                              7. lower-/.f64N/A

                                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \color{blue}{\frac{\sin a}{\cos a}} \]
                              8. lower-sin.f64N/A

                                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                              9. lower-cos.f6460.4

                                \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                            5. Applied rewrites60.4%

                              \[\leadsto \color{blue}{\left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\cos a}} \]
                            6. Taylor expanded in y around 0

                              \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                            7. Step-by-step derivation
                              1. Applied rewrites39.4%

                                \[\leadsto x - \color{blue}{\frac{\sin a}{\cos a}} \]
                              2. Taylor expanded in a around 0

                                \[\leadsto x + -1 \cdot \color{blue}{a} \]
                              3. Step-by-step derivation
                                1. Applied rewrites20.5%

                                  \[\leadsto x - a \]
                                2. Taylor expanded in a around inf

                                  \[\leadsto -1 \cdot a \]
                                3. Step-by-step derivation
                                  1. Applied rewrites3.6%

                                    \[\leadsto -a \]
                                  2. Add Preprocessing

                                  Reproduce

                                  ?
                                  herbie shell --seed 2024276 
                                  (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))))