tan-example (used to crash)

Percentage Accurate: 79.1% → 99.7%
Time: 52.4s
Alternatives: 18
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 18 alternatives:

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

Initial Program: 79.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.3× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    2. associate-*r/99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  6. Applied egg-rr99.7%

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

Alternative 2: 99.7% accurate, 0.3× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    2. associate-*r/99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  6. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  7. Step-by-step derivation
    1. expm1-log1p-u90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan y \cdot \sin z}{\cos z}\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
    2. expm1-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\tan y \cdot \sin z}{\cos z}\right)} - 1\right)}}{\tan y + \tan z}} - \tan a\right) \]
    3. log1p-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(e^{\color{blue}{\log \left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)}} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
    4. add-exp-log99.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(\color{blue}{\left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
    5. associate-/l*99.7%

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(\left(1 + \tan y \cdot \color{blue}{\tan z}\right) - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}}{\tan y + \tan z}} - \tan a\right) \]
  9. Step-by-step derivation
    1. associate--l+99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
    2. fmm-def99.8%

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

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

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

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

Alternative 3: 99.7% accurate, 0.3× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    2. associate-*r/99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  6. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  7. Step-by-step derivation
    1. expm1-log1p-u90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\tan y \cdot \sin z}{\cos z}\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
    2. expm1-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\tan y \cdot \sin z}{\cos z}\right)} - 1\right)}}{\tan y + \tan z}} - \tan a\right) \]
    3. log1p-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(e^{\color{blue}{\log \left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)}} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
    4. add-exp-log99.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(\color{blue}{\left(1 + \frac{\tan y \cdot \sin z}{\cos z}\right)} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
    5. associate-/l*99.7%

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(\left(1 + \tan y \cdot \color{blue}{\tan z}\right) - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}}{\tan y + \tan z}} - \tan a\right) \]
  9. Step-by-step derivation
    1. associate--l+99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
    2. fmm-def99.8%

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

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

    \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
  11. Step-by-step derivation
    1. associate-+r-99.7%

      \[\leadsto \color{blue}{\left(x + \frac{1}{\frac{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}{\tan y + \tan z}}\right) - \tan a} \]
    2. associate-/r/99.7%

      \[\leadsto \left(x + \color{blue}{\frac{1}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)} \cdot \left(\tan y + \tan z\right)}\right) - \tan a \]
    3. associate--r+99.7%

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

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

    \[\leadsto \color{blue}{\left(x + \frac{1}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} \cdot \left(\tan y + \tan z\right)\right) - \tan a} \]
  13. Step-by-step derivation
    1. associate-+r-99.7%

      \[\leadsto \color{blue}{x + \left(\frac{1}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} \cdot \left(\tan y + \tan z\right) - \tan a\right)} \]
    2. associate-*l/99.8%

      \[\leadsto x + \left(\color{blue}{\frac{1 \cdot \left(\tan y + \tan z\right)}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)}} - \tan a\right) \]
    3. *-lft-identity99.8%

      \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right) \]
    4. sub0-neg99.8%

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

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

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

Alternative 4: 99.7% accurate, 0.4× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

    \[\leadsto x + \left(\color{blue}{\frac{1}{\frac{1 - \tan y \cdot \tan z}{\tan y + \tan z}}} - \tan a\right) \]
  5. Step-by-step derivation
    1. expm1-log1p-u90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan y \cdot \tan z\right)\right)}}{\tan y + \tan z}} - \tan a\right) \]
    2. expm1-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\tan y \cdot \tan z\right)} - 1\right)}}{\tan y + \tan z}} - \tan a\right) \]
    3. log1p-undefine90.8%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(e^{\color{blue}{\log \left(1 + \tan y \cdot \tan z\right)}} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
    4. add-exp-log99.7%

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \left(\color{blue}{\left(\tan y \cdot \tan z + 1\right)} - 1\right)}{\tan y + \tan z}} - \tan a\right) \]
  6. Applied egg-rr99.7%

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

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

Alternative 5: 99.7% accurate, 0.4× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

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

Alternative 6: 99.7% accurate, 0.4× speedup?

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

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

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

      \[\leadsto \color{blue}{\left(\tan \left(y + z\right) + \left(-\tan a\right)\right)} + x \]
    3. associate-+l+77.2%

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

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

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

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

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

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

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

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

      \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} + \color{blue}{\left(-1 \cdot \tan a + x\right)} \]
    3. neg-mul-199.6%

      \[\leadsto \left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} + \left(\color{blue}{\left(-\tan a\right)} + x\right) \]
    4. associate-+r+99.7%

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

      \[\leadsto \color{blue}{\left(\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z} - \tan a\right)} + x \]
    6. associate-*r/99.7%

      \[\leadsto \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) + x \]
    7. *-rgt-identity99.7%

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

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

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

Alternative 7: 89.3% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\ \;\;\;\;x + \left(\frac{1}{\frac{1}{t\_0}} - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{\frac{1 - \tan y \cdot \tan z}{t\_0}} - a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))))
   (if (or (<= a -2.6) (not (<= a 0.0275)))
     (+ x (- (/ 1.0 (/ 1.0 t_0)) (tan a)))
     (+ x (- (/ 1.0 (/ (- 1.0 (* (tan y) (tan z))) t_0)) a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0275)) {
		tmp = x + ((1.0 / (1.0 / t_0)) - tan(a));
	} else {
		tmp = x + ((1.0 / ((1.0 - (tan(y) * tan(z))) / t_0)) - a);
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    if ((a <= (-2.6d0)) .or. (.not. (a <= 0.0275d0))) then
        tmp = x + ((1.0d0 / (1.0d0 / t_0)) - tan(a))
    else
        tmp = x + ((1.0d0 / ((1.0d0 - (tan(y) * tan(z))) / t_0)) - a)
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0275)) {
		tmp = x + ((1.0 / (1.0 / t_0)) - Math.tan(a));
	} else {
		tmp = x + ((1.0 / ((1.0 - (Math.tan(y) * Math.tan(z))) / t_0)) - a);
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	tmp = 0
	if (a <= -2.6) or not (a <= 0.0275):
		tmp = x + ((1.0 / (1.0 / t_0)) - math.tan(a))
	else:
		tmp = x + ((1.0 / ((1.0 - (math.tan(y) * math.tan(z))) / t_0)) - a)
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	tmp = 0.0
	if ((a <= -2.6) || !(a <= 0.0275))
		tmp = Float64(x + Float64(Float64(1.0 / Float64(1.0 / t_0)) - tan(a)));
	else
		tmp = Float64(x + Float64(Float64(1.0 / Float64(Float64(1.0 - Float64(tan(y) * tan(z))) / t_0)) - a));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	tmp = 0.0;
	if ((a <= -2.6) || ~((a <= 0.0275)))
		tmp = x + ((1.0 / (1.0 / t_0)) - tan(a));
	else
		tmp = x + ((1.0 / ((1.0 - (tan(y) * tan(z))) / t_0)) - a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -2.6], N[Not[LessEqual[a, 0.0275]], $MachinePrecision]], N[(x + N[(N[(1.0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / N[(N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\
\;\;\;\;x + \left(\frac{1}{\frac{1}{t\_0}} - \tan a\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(\frac{1}{\frac{1 - \tan y \cdot \tan z}{t\_0}} - a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.60000000000000009 or 0.0275000000000000001 < a

    1. Initial program 76.5%

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

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. clear-num99.7%

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

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

        \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
      2. associate-*r/99.8%

        \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    6. Applied egg-rr99.8%

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

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

    if -2.60000000000000009 < a < 0.0275000000000000001

    1. Initial program 77.9%

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

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

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. clear-num99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\ \;\;\;\;x + \left(\frac{1}{\frac{1}{\tan y + \tan z}} - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{\frac{1 - \tan y \cdot \tan z}{\tan y + \tan z}} - a\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 89.3% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\ \;\;\;\;x + \left(\frac{1}{\frac{1}{t\_0}} - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))))
   (if (or (<= a -2.6) (not (<= a 0.0275)))
     (+ x (- (/ 1.0 (/ 1.0 t_0)) (tan a)))
     (+ x (- (/ t_0 (- 1.0 (* (tan y) (tan z)))) a)))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0275)) {
		tmp = x + ((1.0 / (1.0 / t_0)) - tan(a));
	} else {
		tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    if ((a <= (-2.6d0)) .or. (.not. (a <= 0.0275d0))) then
        tmp = x + ((1.0d0 / (1.0d0 / t_0)) - tan(a))
    else
        tmp = x + ((t_0 / (1.0d0 - (tan(y) * tan(z)))) - a)
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0275)) {
		tmp = x + ((1.0 / (1.0 / t_0)) - Math.tan(a));
	} else {
		tmp = x + ((t_0 / (1.0 - (Math.tan(y) * Math.tan(z)))) - a);
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	tmp = 0
	if (a <= -2.6) or not (a <= 0.0275):
		tmp = x + ((1.0 / (1.0 / t_0)) - math.tan(a))
	else:
		tmp = x + ((t_0 / (1.0 - (math.tan(y) * math.tan(z)))) - a)
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	tmp = 0.0
	if ((a <= -2.6) || !(a <= 0.0275))
		tmp = Float64(x + Float64(Float64(1.0 / Float64(1.0 / t_0)) - tan(a)));
	else
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))) - a));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	tmp = 0.0;
	if ((a <= -2.6) || ~((a <= 0.0275)))
		tmp = x + ((1.0 / (1.0 / t_0)) - tan(a));
	else
		tmp = x + ((t_0 / (1.0 - (tan(y) * tan(z)))) - a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -2.6], N[Not[LessEqual[a, 0.0275]], $MachinePrecision]], N[(x + N[(N[(1.0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\
\;\;\;\;x + \left(\frac{1}{\frac{1}{t\_0}} - \tan a\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 - \tan y \cdot \tan z} - a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.60000000000000009 or 0.0275000000000000001 < a

    1. Initial program 76.5%

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

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. clear-num99.7%

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

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

        \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
      2. associate-*r/99.8%

        \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    6. Applied egg-rr99.8%

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

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

    if -2.60000000000000009 < a < 0.0275000000000000001

    1. Initial program 77.9%

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

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

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - a\right) \]
      2. div-inv98.7%

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

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - a\right) \]
    6. Step-by-step derivation
      1. associate-*r/98.7%

        \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - a\right) \]
      2. *-rgt-identity98.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0275\right):\\ \;\;\;\;x + \left(\frac{1}{\frac{1}{\tan y + \tan z}} - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - a\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 79.5% accurate, 0.7× speedup?

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

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

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. clear-num99.7%

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

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

      \[\leadsto x + \left(\frac{1}{\frac{1 - \tan y \cdot \color{blue}{\frac{\sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
    2. associate-*r/99.7%

      \[\leadsto x + \left(\frac{1}{\frac{1 - \color{blue}{\frac{\tan y \cdot \sin z}{\cos z}}}{\tan y + \tan z}} - \tan a\right) \]
  6. Applied egg-rr99.7%

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

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

Alternative 10: 79.1% accurate, 0.7× speedup?

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

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

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

Alternative 11: 69.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0022\right):\\ \;\;\;\;x + \left(\tan y - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (if (or (<= a -2.6) (not (<= a 0.0022)))
   (+ x (- (tan y) (tan a)))
   (+ x (- (tan (+ y z)) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0022)) {
		tmp = x + (tan(y) - tan(a));
	} else {
		tmp = x + (tan((y + z)) - a);
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-2.6d0)) .or. (.not. (a <= 0.0022d0))) then
        tmp = x + (tan(y) - tan(a))
    else
        tmp = x + (tan((y + z)) - a)
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -2.6) || !(a <= 0.0022)) {
		tmp = x + (Math.tan(y) - Math.tan(a));
	} else {
		tmp = x + (Math.tan((y + z)) - a);
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	tmp = 0
	if (a <= -2.6) or not (a <= 0.0022):
		tmp = x + (math.tan(y) - math.tan(a))
	else:
		tmp = x + (math.tan((y + z)) - a)
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	tmp = 0.0
	if ((a <= -2.6) || !(a <= 0.0022))
		tmp = Float64(x + Float64(tan(y) - tan(a)));
	else
		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	tmp = 0.0;
	if ((a <= -2.6) || ~((a <= 0.0022)))
		tmp = x + (tan(y) - tan(a));
	else
		tmp = x + (tan((y + z)) - a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -2.6], N[Not[LessEqual[a, 0.0022]], $MachinePrecision]], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.0022\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.60000000000000009 or 0.00220000000000000013 < a

    1. Initial program 76.0%

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

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

    if -2.60000000000000009 < a < 0.00220000000000000013

    1. Initial program 78.3%

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

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

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

Alternative 12: 78.8% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.50000000000000019e-6

    1. Initial program 63.1%

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

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

    if -7.50000000000000019e-6 < y

    1. Initial program 81.7%

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

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

Alternative 13: 79.1% accurate, 1.0× speedup?

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

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

Alternative 14: 56.3% accurate, 1.8× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -23 \lor \neg \left(a \leq 0.3\right):\\ \;\;\;\;x + \left(z - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (if (or (<= a -23.0) (not (<= a 0.3)))
   (+ x (- z (tan a)))
   (+ x (- (tan (+ y z)) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -23.0) || !(a <= 0.3)) {
		tmp = x + (z - tan(a));
	} else {
		tmp = x + (tan((y + z)) - a);
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-23.0d0)) .or. (.not. (a <= 0.3d0))) then
        tmp = x + (z - tan(a))
    else
        tmp = x + (tan((y + z)) - a)
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -23.0) || !(a <= 0.3)) {
		tmp = x + (z - Math.tan(a));
	} else {
		tmp = x + (Math.tan((y + z)) - a);
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	tmp = 0
	if (a <= -23.0) or not (a <= 0.3):
		tmp = x + (z - math.tan(a))
	else:
		tmp = x + (math.tan((y + z)) - a)
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	tmp = 0.0
	if ((a <= -23.0) || !(a <= 0.3))
		tmp = Float64(x + Float64(z - tan(a)));
	else
		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	tmp = 0.0;
	if ((a <= -23.0) || ~((a <= 0.3)))
		tmp = x + (z - tan(a));
	else
		tmp = x + (tan((y + z)) - a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -23.0], N[Not[LessEqual[a, 0.3]], $MachinePrecision]], N[(x + N[(z - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -23 \lor \neg \left(a \leq 0.3\right):\\
\;\;\;\;x + \left(z - \tan a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -23 or 0.299999999999999989 < a

    1. Initial program 76.3%

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

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

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

    if -23 < a < 0.299999999999999989

    1. Initial program 78.1%

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

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

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

Alternative 15: 46.9% accurate, 1.8× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.175\right):\\ \;\;\;\;x + \left(z - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan y - a\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
(FPCore (x y z a)
 :precision binary64
 (if (or (<= a -2.6) (not (<= a 0.175)))
   (+ x (- z (tan a)))
   (+ x (- (tan y) a))))
assert(x < y && y < z && z < a);
double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -2.6) || !(a <= 0.175)) {
		tmp = x + (z - tan(a));
	} else {
		tmp = x + (tan(y) - a);
	}
	return tmp;
}
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-2.6d0)) .or. (.not. (a <= 0.175d0))) then
        tmp = x + (z - tan(a))
    else
        tmp = x + (tan(y) - a)
    end if
    code = tmp
end function
assert x < y && y < z && z < a;
public static double code(double x, double y, double z, double a) {
	double tmp;
	if ((a <= -2.6) || !(a <= 0.175)) {
		tmp = x + (z - Math.tan(a));
	} else {
		tmp = x + (Math.tan(y) - a);
	}
	return tmp;
}
[x, y, z, a] = sort([x, y, z, a])
def code(x, y, z, a):
	tmp = 0
	if (a <= -2.6) or not (a <= 0.175):
		tmp = x + (z - math.tan(a))
	else:
		tmp = x + (math.tan(y) - a)
	return tmp
x, y, z, a = sort([x, y, z, a])
function code(x, y, z, a)
	tmp = 0.0
	if ((a <= -2.6) || !(a <= 0.175))
		tmp = Float64(x + Float64(z - tan(a)));
	else
		tmp = Float64(x + Float64(tan(y) - a));
	end
	return tmp
end
x, y, z, a = num2cell(sort([x, y, z, a])){:}
function tmp_2 = code(x, y, z, a)
	tmp = 0.0;
	if ((a <= -2.6) || ~((a <= 0.175)))
		tmp = x + (z - tan(a));
	else
		tmp = x + (tan(y) - a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, a_] := If[Or[LessEqual[a, -2.6], N[Not[LessEqual[a, 0.175]], $MachinePrecision]], N[(x + N[(z - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \lor \neg \left(a \leq 0.175\right):\\
\;\;\;\;x + \left(z - \tan a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.60000000000000009 or 0.17499999999999999 < a

    1. Initial program 76.3%

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

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

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

    if -2.60000000000000009 < a < 0.17499999999999999

    1. Initial program 78.1%

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

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

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

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

Alternative 16: 47.2% accurate, 1.8× speedup?

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

\mathbf{elif}\;z \leq 580:\\
\;\;\;\;x + \left(z - \tan a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.40000000000000024e-221

    1. Initial program 71.6%

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

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

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

    if -2.40000000000000024e-221 < z < 580

    1. Initial program 99.9%

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

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

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

    if 580 < z

    1. Initial program 56.7%

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

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

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

Alternative 17: 40.7% accurate, 1.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.3999999999999999

    1. Initial program 83.1%

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

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

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

    if 1.3999999999999999 < z

    1. Initial program 56.7%

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

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

Alternative 18: 31.8% accurate, 207.0× speedup?

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

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

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

Reproduce

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