tan-example (used to crash)

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

    \[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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\tan z \cdot \tan y}} - \tan a\right) \]
    14. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

    \[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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\tan z \cdot \tan y}} - \tan a\right) \]
    14. fp-cancel-sub-sign-invN/A

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

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

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

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

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

Alternative 3: 80.3% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ x + \left(\frac{\tan y + \tan z}{1} - \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 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(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(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(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(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)) / 1.0) - 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(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] / 1.0), $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 a\right)
\end{array}
Derivation
  1. Initial program 76.9%

    \[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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\tan z \cdot \tan y}} - \tan a\right) \]
    14. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

    Alternative 4: 69.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^{-35}:\\ \;\;\;\;x + \left(\tan y - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;\tan \left(z \cdot \left(\frac{y}{z} - -1\right)\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-35)
       (+ x (- (tan y) (tan a)))
       (- (tan (* z (- (/ y z) -1.0))) (- x))))
    assert(x < y && y < z && z < a);
    double code(double x, double y, double z, double a) {
    	double tmp;
    	if ((y + z) <= 1e-35) {
    		tmp = x + (tan(y) - tan(a));
    	} else {
    		tmp = tan((z * ((y / z) - -1.0))) - -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-35) then
            tmp = x + (tan(y) - tan(a))
        else
            tmp = tan((z * ((y / z) - (-1.0d0)))) - -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-35) {
    		tmp = x + (Math.tan(y) - Math.tan(a));
    	} else {
    		tmp = Math.tan((z * ((y / z) - -1.0))) - -x;
    	}
    	return tmp;
    }
    
    [x, y, z, a] = sort([x, y, z, a])
    def code(x, y, z, a):
    	tmp = 0
    	if (y + z) <= 1e-35:
    		tmp = x + (math.tan(y) - math.tan(a))
    	else:
    		tmp = math.tan((z * ((y / z) - -1.0))) - -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-35)
    		tmp = Float64(x + Float64(tan(y) - tan(a)));
    	else
    		tmp = Float64(tan(Float64(z * Float64(Float64(y / z) - -1.0))) - 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-35)
    		tmp = x + (tan(y) - tan(a));
    	else
    		tmp = tan((z * ((y / z) - -1.0))) - -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-35], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[N[(z * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $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^{-35}:\\
    \;\;\;\;x + \left(\tan y - \tan a\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\tan \left(z \cdot \left(\frac{y}{z} - -1\right)\right) - \left(-x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (+.f64 y z) < 1.00000000000000001e-35

      1. Initial program 79.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.f6466.3

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

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

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

        if 1.00000000000000001e-35 < (+.f64 y z)

        1. Initial program 72.8%

          \[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.7

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

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

          \[\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.f6448.4

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

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

          \[\leadsto \tan \color{blue}{\left(-1 \cdot \left(z \cdot \left(-1 \cdot \frac{y}{z} - 1\right)\right)\right)} - \left(-x\right) \]
        9. Step-by-step derivation
          1. associate-*r*N/A

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

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

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

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

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

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

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

            \[\leadsto \tan \left(\left(-z\right) \cdot \left(\color{blue}{\frac{\mathsf{neg}\left(y\right)}{z}} - 1\right)\right) - \left(-x\right) \]
          9. lower-neg.f6437.4

            \[\leadsto \tan \left(\left(-z\right) \cdot \left(\frac{\color{blue}{-y}}{z} - 1\right)\right) - \left(-x\right) \]
        10. Applied rewrites37.4%

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

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

      Alternative 5: 79.6% accurate, 1.0× speedup?

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

        1. Initial program 83.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.f6473.0

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

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

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

          if 6.4000000000000004e-8 < z

          1. Initial program 59.3%

            \[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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\tan z \cdot \tan y}} - \tan a\right) \]
            14. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

              \[\leadsto x + \left(\frac{\color{blue}{\sin z}}{\cos z} - \tan a\right) \]
            3. lower-cos.f6459.2

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          9. Applied rewrites59.2%

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

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

              \[\leadsto \color{blue}{\left(\frac{\sin z}{\cos z} - \tan a\right) + x} \]
            3. lower-+.f6459.2

              \[\leadsto \color{blue}{\left(\frac{\sin z}{\cos z} - \tan a\right) + x} \]
          11. Applied rewrites59.2%

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

        Alternative 6: 79.9% 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 76.9%

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

        Alternative 7: 59.5% accurate, 1.5× speedup?

        \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;y + z \leq -1:\\ \;\;\;\;\tan \left(z + y\right) - \left(-x\right)\\ \mathbf{elif}\;y + z \leq 10^{-35}:\\ \;\;\;\;\left(y + x\right) - \tan a\\ \mathbf{else}:\\ \;\;\;\;\tan \left(z \cdot \left(\frac{y}{z} - -1\right)\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) -1.0)
           (- (tan (+ z y)) (- x))
           (if (<= (+ y z) 1e-35)
             (- (+ y x) (tan a))
             (- (tan (* z (- (/ y z) -1.0))) (- x)))))
        assert(x < y && y < z && z < a);
        double code(double x, double y, double z, double a) {
        	double tmp;
        	if ((y + z) <= -1.0) {
        		tmp = tan((z + y)) - -x;
        	} else if ((y + z) <= 1e-35) {
        		tmp = (y + x) - tan(a);
        	} else {
        		tmp = tan((z * ((y / z) - -1.0))) - -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) <= (-1.0d0)) then
                tmp = tan((z + y)) - -x
            else if ((y + z) <= 1d-35) then
                tmp = (y + x) - tan(a)
            else
                tmp = tan((z * ((y / z) - (-1.0d0)))) - -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) <= -1.0) {
        		tmp = Math.tan((z + y)) - -x;
        	} else if ((y + z) <= 1e-35) {
        		tmp = (y + x) - Math.tan(a);
        	} else {
        		tmp = Math.tan((z * ((y / z) - -1.0))) - -x;
        	}
        	return tmp;
        }
        
        [x, y, z, a] = sort([x, y, z, a])
        def code(x, y, z, a):
        	tmp = 0
        	if (y + z) <= -1.0:
        		tmp = math.tan((z + y)) - -x
        	elif (y + z) <= 1e-35:
        		tmp = (y + x) - math.tan(a)
        	else:
        		tmp = math.tan((z * ((y / z) - -1.0))) - -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) <= -1.0)
        		tmp = Float64(tan(Float64(z + y)) - Float64(-x));
        	elseif (Float64(y + z) <= 1e-35)
        		tmp = Float64(Float64(y + x) - tan(a));
        	else
        		tmp = Float64(tan(Float64(z * Float64(Float64(y / z) - -1.0))) - 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) <= -1.0)
        		tmp = tan((z + y)) - -x;
        	elseif ((y + z) <= 1e-35)
        		tmp = (y + x) - tan(a);
        	else
        		tmp = tan((z * ((y / z) - -1.0))) - -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], -1.0], N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] - (-x)), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 1e-35], N[(N[(y + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(N[Tan[N[(z * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $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 -1:\\
        \;\;\;\;\tan \left(z + y\right) - \left(-x\right)\\
        
        \mathbf{elif}\;y + z \leq 10^{-35}:\\
        \;\;\;\;\left(y + x\right) - \tan a\\
        
        \mathbf{else}:\\
        \;\;\;\;\tan \left(z \cdot \left(\frac{y}{z} - -1\right)\right) - \left(-x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 y z) < -1

          1. Initial program 68.8%

            \[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--.f6468.7

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

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

            \[\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.f6441.0

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

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

          if -1 < (+.f64 y z) < 1.00000000000000001e-35

          1. Initial program 99.8%

            \[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.f6499.8

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

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

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

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

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

              if 1.00000000000000001e-35 < (+.f64 y z)

              1. Initial program 72.8%

                \[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.7

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

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

                \[\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.f6448.4

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

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

                \[\leadsto \tan \color{blue}{\left(-1 \cdot \left(z \cdot \left(-1 \cdot \frac{y}{z} - 1\right)\right)\right)} - \left(-x\right) \]
              9. Step-by-step derivation
                1. associate-*r*N/A

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

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

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

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

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

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

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

                  \[\leadsto \tan \left(\left(-z\right) \cdot \left(\color{blue}{\frac{\mathsf{neg}\left(y\right)}{z}} - 1\right)\right) - \left(-x\right) \]
                9. lower-neg.f6437.4

                  \[\leadsto \tan \left(\left(-z\right) \cdot \left(\frac{\color{blue}{-y}}{z} - 1\right)\right) - \left(-x\right) \]
              10. Applied rewrites37.4%

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

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

            Alternative 8: 59.5% accurate, 1.7× speedup?

            \[\begin{array}{l} [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\ \\ \begin{array}{l} \mathbf{if}\;y + z \leq -1 \lor \neg \left(y + z \leq 10^{-35}\right):\\ \;\;\;\;\tan \left(z + y\right) - \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \tan a\\ \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 (<= (+ y z) -1.0) (not (<= (+ y z) 1e-35)))
               (- (tan (+ z y)) (- x))
               (- (+ y x) (tan a))))
            assert(x < y && y < z && z < a);
            double code(double x, double y, double z, double a) {
            	double tmp;
            	if (((y + z) <= -1.0) || !((y + z) <= 1e-35)) {
            		tmp = tan((z + y)) - -x;
            	} else {
            		tmp = (y + x) - tan(a);
            	}
            	return tmp;
            }
            
            NOTE: x, y, z, and a should be sorted in increasing order before calling this function.
            real(8) function code(x, y, z, a)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: a
                real(8) :: tmp
                if (((y + z) <= (-1.0d0)) .or. (.not. ((y + z) <= 1d-35))) then
                    tmp = tan((z + y)) - -x
                else
                    tmp = (y + x) - tan(a)
                end if
                code = tmp
            end function
            
            assert x < y && y < z && z < a;
            public static double code(double x, double y, double z, double a) {
            	double tmp;
            	if (((y + z) <= -1.0) || !((y + z) <= 1e-35)) {
            		tmp = Math.tan((z + y)) - -x;
            	} else {
            		tmp = (y + x) - Math.tan(a);
            	}
            	return tmp;
            }
            
            [x, y, z, a] = sort([x, y, z, a])
            def code(x, y, z, a):
            	tmp = 0
            	if ((y + z) <= -1.0) or not ((y + z) <= 1e-35):
            		tmp = math.tan((z + y)) - -x
            	else:
            		tmp = (y + x) - math.tan(a)
            	return tmp
            
            x, y, z, a = sort([x, y, z, a])
            function code(x, y, z, a)
            	tmp = 0.0
            	if ((Float64(y + z) <= -1.0) || !(Float64(y + z) <= 1e-35))
            		tmp = Float64(tan(Float64(z + y)) - Float64(-x));
            	else
            		tmp = Float64(Float64(y + x) - tan(a));
            	end
            	return tmp
            end
            
            x, y, z, a = num2cell(sort([x, y, z, a])){:}
            function tmp_2 = code(x, y, z, a)
            	tmp = 0.0;
            	if (((y + z) <= -1.0) || ~(((y + z) <= 1e-35)))
            		tmp = tan((z + y)) - -x;
            	else
            		tmp = (y + x) - 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[Or[LessEqual[N[(y + z), $MachinePrecision], -1.0], N[Not[LessEqual[N[(y + z), $MachinePrecision], 1e-35]], $MachinePrecision]], N[(N[Tan[N[(z + y), $MachinePrecision]], $MachinePrecision] - (-x)), $MachinePrecision], N[(N[(y + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            [x, y, z, a] = \mathsf{sort}([x, y, z, a])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;y + z \leq -1 \lor \neg \left(y + z \leq 10^{-35}\right):\\
            \;\;\;\;\tan \left(z + y\right) - \left(-x\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(y + x\right) - \tan a\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (+.f64 y z) < -1 or 1.00000000000000001e-35 < (+.f64 y z)

              1. Initial program 71.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--.f6470.9

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

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

                \[\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.f6445.0

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

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

              if -1 < (+.f64 y z) < 1.00000000000000001e-35

              1. Initial program 99.8%

                \[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.f6499.8

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

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

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

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

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

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

                Alternative 9: 31.7% accurate, 2.0× speedup?

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

                    \[\leadsto \left(\frac{\sin y}{\cos y} + x\right) - \frac{\sin a}{\color{blue}{\cos a}} \]
                5. Applied rewrites59.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 \left(x + y\right) - \frac{\color{blue}{\sin a}}{\cos a} \]
                7. Step-by-step derivation
                  1. Applied rewrites30.2%

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

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

                    Reproduce

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