tan-example (used to crash)

Percentage Accurate: 79.3% → 99.7%
Time: 33.6s
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.3% 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.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\tan y, \tan z, 1\right)\\ x + \mathsf{fma}\left(\frac{1}{\frac{1}{t\_0} - \frac{{\left(\tan y \cdot \tan z\right)}^{2}}{t\_0}}, \tan y + \tan z, -\tan a\right) \end{array} \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (fma (tan y) (tan z) 1.0)))
   (+
    x
    (fma
     (/ 1.0 (- (/ 1.0 t_0) (/ (pow (* (tan y) (tan z)) 2.0) t_0)))
     (+ (tan y) (tan z))
     (- (tan a))))))
double code(double x, double y, double z, double a) {
	double t_0 = fma(tan(y), tan(z), 1.0);
	return x + fma((1.0 / ((1.0 / t_0) - (pow((tan(y) * tan(z)), 2.0) / t_0))), (tan(y) + tan(z)), -tan(a));
}
function code(x, y, z, a)
	t_0 = fma(tan(y), tan(z), 1.0)
	return Float64(x + fma(Float64(1.0 / Float64(Float64(1.0 / t_0) - Float64((Float64(tan(y) * tan(z)) ^ 2.0) / t_0))), Float64(tan(y) + tan(z)), Float64(-tan(a))))
end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision] + 1.0), $MachinePrecision]}, N[(x + N[(N[(1.0 / N[(N[(1.0 / t$95$0), $MachinePrecision] - N[(N[Power[N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\tan y, \tan z, 1\right)\\
x + \mathsf{fma}\left(\frac{1}{\frac{1}{t\_0} - \frac{{\left(\tan y \cdot \tan z\right)}^{2}}{t\_0}}, \tan y + \tan z, -\tan a\right)
\end{array}
\end{array}
Derivation
  1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ x + \mathsf{fma}\left(\frac{1}{\frac{1}{\mathsf{fma}\left(\tan y, \tan z, 1\right)} \cdot \left(1 - {\left(\tan y \cdot \tan z\right)}^{2}\right)}, \tan y + \tan z, -\tan a\right) \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (+
  x
  (fma
   (/
    1.0
    (*
     (/ 1.0 (fma (tan y) (tan z) 1.0))
     (- 1.0 (pow (* (tan y) (tan z)) 2.0))))
   (+ (tan y) (tan z))
   (- (tan a)))))
double code(double x, double y, double z, double a) {
	return x + fma((1.0 / ((1.0 / fma(tan(y), tan(z), 1.0)) * (1.0 - pow((tan(y) * tan(z)), 2.0)))), (tan(y) + tan(z)), -tan(a));
}
function code(x, y, z, a)
	return Float64(x + fma(Float64(1.0 / Float64(Float64(1.0 / fma(tan(y), tan(z), 1.0)) * Float64(1.0 - (Float64(tan(y) * tan(z)) ^ 2.0)))), Float64(tan(y) + tan(z)), Float64(-tan(a))))
end
code[x_, y_, z_, a_] := N[(x + N[(N[(1.0 / N[(N[(1.0 / N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Power[N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \mathsf{fma}\left(\frac{1}{\frac{1}{\mathsf{fma}\left(\tan y, \tan z, 1\right)} \cdot \left(1 - {\left(\tan y \cdot \tan z\right)}^{2}\right)}, \tan y + \tan z, -\tan a\right)
\end{array}
Derivation
  1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan y + \tan z\\ t_1 := x + \mathsf{fma}\left(1, t\_0, -\tan a\right)\\ \mathbf{if}\;\tan a \leq -0.002:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{1 - \tan y \cdot \tan z}, t\_0, x - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))) (t_1 (+ x (fma 1.0 t_0 (- (tan a))))))
   (if (<= (tan a) -0.002)
     t_1
     (if (<= (tan a) 1e-19)
       (fma (/ 1.0 (- 1.0 (* (tan y) (tan z)))) t_0 (- x a))
       t_1))))
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double t_1 = x + fma(1.0, t_0, -tan(a));
	double tmp;
	if (tan(a) <= -0.002) {
		tmp = t_1;
	} else if (tan(a) <= 1e-19) {
		tmp = fma((1.0 / (1.0 - (tan(y) * tan(z)))), t_0, (x - a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	t_1 = Float64(x + fma(1.0, t_0, Float64(-tan(a))))
	tmp = 0.0
	if (tan(a) <= -0.002)
		tmp = t_1;
	elseif (tan(a) <= 1e-19)
		tmp = fma(Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z)))), t_0, Float64(x - a));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(1.0 * t$95$0 + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.002], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 1e-19], N[(N[(1.0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(x - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
t_1 := x + \mathsf{fma}\left(1, t\_0, -\tan a\right)\\
\mathbf{if}\;\tan a \leq -0.002:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2e-3 < (tan.f64 a) < 9.9999999999999998e-20

      1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 99.7% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ x + \mathsf{fma}\left(\frac{1}{1 - \tan y \cdot \tan z}, \tan y + \tan z, -\tan a\right) \end{array} \]
    (FPCore (x y z a)
     :precision binary64
     (+
      x
      (fma (/ 1.0 (- 1.0 (* (tan y) (tan z)))) (+ (tan y) (tan z)) (- (tan a)))))
    double code(double x, double y, double z, double a) {
    	return x + fma((1.0 / (1.0 - (tan(y) * tan(z)))), (tan(y) + tan(z)), -tan(a));
    }
    
    function code(x, y, z, a)
    	return Float64(x + fma(Float64(1.0 / Float64(1.0 - Float64(tan(y) * tan(z)))), Float64(tan(y) + tan(z)), Float64(-tan(a))))
    end
    
    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[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    x + \mathsf{fma}\left(\frac{1}{1 - \tan y \cdot \tan z}, \tan y + \tan z, -\tan a\right)
    \end{array}
    
    Derivation
    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 99.7% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \end{array} \]
    (FPCore (x y z a)
     :precision binary64
     (+ x (- (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (tan 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));
    }
    
    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
    
    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));
    }
    
    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))
    
    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
    
    function tmp = code(x, y, z, a)
    	tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) - tan(a));
    end
    
    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 + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right)
    \end{array}
    
    Derivation
    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 69.3% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \left(\tan z - \tan a\right)\\ \mathbf{if}\;\tan a \leq -0.002:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-13}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z a)
     :precision binary64
     (let* ((t_0 (+ x (- (tan z) (tan a)))))
       (if (<= (tan a) -0.002)
         t_0
         (if (<= (tan a) 5e-13)
           (+ x (- (tan (+ y z)) (fma (* a a) (* a 0.3333333333333333) a)))
           t_0))))
    double code(double x, double y, double z, double a) {
    	double t_0 = x + (tan(z) - tan(a));
    	double tmp;
    	if (tan(a) <= -0.002) {
    		tmp = t_0;
    	} else if (tan(a) <= 5e-13) {
    		tmp = x + (tan((y + z)) - fma((a * a), (a * 0.3333333333333333), a));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z, a)
    	t_0 = Float64(x + Float64(tan(z) - tan(a)))
    	tmp = 0.0
    	if (tan(a) <= -0.002)
    		tmp = t_0;
    	elseif (tan(a) <= 5e-13)
    		tmp = Float64(x + Float64(tan(Float64(y + z)) - fma(Float64(a * a), Float64(a * 0.3333333333333333), a)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -0.002], t$95$0, If[LessEqual[N[Tan[a], $MachinePrecision], 5e-13], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * N[(a * 0.3333333333333333), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x + \left(\tan z - \tan a\right)\\
    \mathbf{if}\;\tan a \leq -0.002:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-13}:\\
    \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (tan.f64 a) < -2e-3 or 4.9999999999999999e-13 < (tan.f64 a)

      1. Initial program 79.5%

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

        \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
      4. 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.f6464.1

          \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
      5. Simplified64.1%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\color{blue}{\tan z} - \tan a\right) + x \]
        12. lift-tan.f6464.1

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

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

      if -2e-3 < (tan.f64 a) < 4.9999999999999999e-13

      1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 79.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ x + \mathsf{fma}\left(1, \tan y + \tan z, -\tan a\right) \end{array} \]
    (FPCore (x y z a)
     :precision binary64
     (+ x (fma 1.0 (+ (tan y) (tan z)) (- (tan a)))))
    double code(double x, double y, double z, double a) {
    	return x + fma(1.0, (tan(y) + tan(z)), -tan(a));
    }
    
    function code(x, y, z, a)
    	return Float64(x + fma(1.0, Float64(tan(y) + tan(z)), Float64(-tan(a))))
    end
    
    code[x_, y_, z_, a_] := N[(x + N[(1.0 * N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] + (-N[Tan[a], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    x + \mathsf{fma}\left(1, \tan y + \tan z, -\tan a\right)
    \end{array}
    
    Derivation
    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 79.2% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(x, \frac{x \cdot \tan \left(y + z\right) - x \cdot \tan a}{x \cdot x}, x\right) \end{array} \]
      (FPCore (x y z a)
       :precision binary64
       (fma x (/ (- (* x (tan (+ y z))) (* x (tan a))) (* x x)) x))
      double code(double x, double y, double z, double a) {
      	return fma(x, (((x * tan((y + z))) - (x * tan(a))) / (x * x)), x);
      }
      
      function code(x, y, z, a)
      	return fma(x, Float64(Float64(Float64(x * tan(Float64(y + z))) - Float64(x * tan(a))) / Float64(x * x)), x)
      end
      
      code[x_, y_, z_, a_] := N[(x * N[(N[(N[(x * N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(x * N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(x, \frac{x \cdot \tan \left(y + z\right) - x \cdot \tan a}{x \cdot x}, x\right)
      \end{array}
      
      Derivation
      1. Initial program 78.4%

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

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

          \[\leadsto x \cdot \color{blue}{\left(1 + \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)\right)} \]
        2. distribute-lft-inN/A

          \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)} \]
        3. *-rgt-identityN/A

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

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

          \[\leadsto x \cdot \left(\color{blue}{\frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}{x}} - \frac{\sin a}{x \cdot \cos a}\right) + x \]
        6. associate-/l/N/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)} - \frac{\sin a}{\cos a}}{x}, x\right)} \]
      5. Simplified78.4%

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, \frac{\sin \left(y + z\right)}{\color{blue}{\cos \left(y + z\right) \cdot x}} - \frac{\sin a}{\cos a \cdot x}, x\right) \]
        10. associate-/r*N/A

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

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

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

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

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

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

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

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

      Alternative 9: 79.3% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(x, \frac{\tan \left(y + z\right)}{x} - \frac{\tan a}{x}, x\right) \end{array} \]
      (FPCore (x y z a)
       :precision binary64
       (fma x (- (/ (tan (+ y z)) x) (/ (tan a) x)) x))
      double code(double x, double y, double z, double a) {
      	return fma(x, ((tan((y + z)) / x) - (tan(a) / x)), x);
      }
      
      function code(x, y, z, a)
      	return fma(x, Float64(Float64(tan(Float64(y + z)) / x) - Float64(tan(a) / x)), x)
      end
      
      code[x_, y_, z_, a_] := N[(x * N[(N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision] - N[(N[Tan[a], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(x, \frac{\tan \left(y + z\right)}{x} - \frac{\tan a}{x}, x\right)
      \end{array}
      
      Derivation
      1. Initial program 78.4%

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

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

          \[\leadsto x \cdot \color{blue}{\left(1 + \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)\right)} \]
        2. distribute-lft-inN/A

          \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)} \]
        3. *-rgt-identityN/A

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

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

          \[\leadsto x \cdot \left(\color{blue}{\frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}{x}} - \frac{\sin a}{x \cdot \cos a}\right) + x \]
        6. associate-/l/N/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)} - \frac{\sin a}{\cos a}}{x}, x\right)} \]
      5. Simplified78.4%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, \frac{\sin \left(y + z\right)}{\cos \left(y + z\right) \cdot x} - \color{blue}{\frac{\sin a}{\cos a \cdot x}}, x\right) \]
        11. lift--.f6478.4

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right) \cdot x} - \frac{\sin a}{\cos a \cdot x}}, x\right) \]
      7. Applied egg-rr78.4%

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

      Alternative 10: 79.2% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(x, \tan \left(y + z\right), \tan a \cdot \left(-x\right)\right), \frac{1}{x}, x\right) \end{array} \]
      (FPCore (x y z a)
       :precision binary64
       (fma (fma x (tan (+ y z)) (* (tan a) (- x))) (/ 1.0 x) x))
      double code(double x, double y, double z, double a) {
      	return fma(fma(x, tan((y + z)), (tan(a) * -x)), (1.0 / x), x);
      }
      
      function code(x, y, z, a)
      	return fma(fma(x, tan(Float64(y + z)), Float64(tan(a) * Float64(-x))), Float64(1.0 / x), x)
      end
      
      code[x_, y_, z_, a_] := N[(N[(x * N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(N[Tan[a], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision] + x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(\mathsf{fma}\left(x, \tan \left(y + z\right), \tan a \cdot \left(-x\right)\right), \frac{1}{x}, x\right)
      \end{array}
      
      Derivation
      1. Initial program 78.4%

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

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

          \[\leadsto x \cdot \color{blue}{\left(1 + \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)\right)} \]
        2. distribute-lft-inN/A

          \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(\frac{\sin \left(y + z\right)}{x \cdot \cos \left(y + z\right)} - \frac{\sin a}{x \cdot \cos a}\right)} \]
        3. *-rgt-identityN/A

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

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

          \[\leadsto x \cdot \left(\color{blue}{\frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}{x}} - \frac{\sin a}{x \cdot \cos a}\right) + x \]
        6. associate-/l/N/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)} - \frac{\sin a}{\cos a}}{x}, x\right)} \]
      5. Simplified78.4%

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, \frac{\sin \left(y + z\right)}{\color{blue}{\cos \left(y + z\right) \cdot x}} - \frac{\sin a}{\cos a \cdot x}, x\right) \]
        10. associate-/r*N/A

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

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

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

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

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

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

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

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

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

        Alternative 11: 79.3% 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}
        
        Derivation
        1. Initial program 78.4%

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

        Alternative 12: 50.2% accurate, 1.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y + z \leq -2 \cdot 10^{-11}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right)\\ \mathbf{elif}\;y + z \leq 5 \cdot 10^{-29}:\\ \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \tan z\\ \end{array} \end{array} \]
        (FPCore (x y z a)
         :precision binary64
         (if (<= (+ y z) -2e-11)
           (+ x (- (tan (+ y z)) (fma (* a a) (* a 0.3333333333333333) a)))
           (if (<= (+ y z) 5e-29)
             (+ x (- (fma 0.3333333333333333 (* z (* z z)) z) (tan a)))
             (+ x (tan z)))))
        double code(double x, double y, double z, double a) {
        	double tmp;
        	if ((y + z) <= -2e-11) {
        		tmp = x + (tan((y + z)) - fma((a * a), (a * 0.3333333333333333), a));
        	} else if ((y + z) <= 5e-29) {
        		tmp = x + (fma(0.3333333333333333, (z * (z * z)), z) - tan(a));
        	} else {
        		tmp = x + tan(z);
        	}
        	return tmp;
        }
        
        function code(x, y, z, a)
        	tmp = 0.0
        	if (Float64(y + z) <= -2e-11)
        		tmp = Float64(x + Float64(tan(Float64(y + z)) - fma(Float64(a * a), Float64(a * 0.3333333333333333), a)));
        	elseif (Float64(y + z) <= 5e-29)
        		tmp = Float64(x + Float64(fma(0.3333333333333333, Float64(z * Float64(z * z)), z) - tan(a)));
        	else
        		tmp = Float64(x + tan(z));
        	end
        	return tmp
        end
        
        code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -2e-11], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * N[(a * 0.3333333333333333), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 5e-29], N[(x + N[(N[(0.3333333333333333 * N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Tan[z], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y + z \leq -2 \cdot 10^{-11}:\\
        \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right)\\
        
        \mathbf{elif}\;y + z \leq 5 \cdot 10^{-29}:\\
        \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \tan z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 y z) < -1.99999999999999988e-11

          1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.99999999999999988e-11 < (+.f64 y z) < 4.99999999999999986e-29

          1. Initial program 99.6%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6499.6

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          5. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 4.99999999999999986e-29 < (+.f64 y z)

          1. Initial program 73.7%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6451.4

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          5. Simplified51.4%

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

            \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
            4. lower-sin.f64N/A

              \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
            5. lower-cos.f6438.6

              \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
          8. Simplified38.6%

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          9. Step-by-step derivation
            1. tan-quotN/A

              \[\leadsto \color{blue}{\tan z} + x \]
            2. lift-tan.f64N/A

              \[\leadsto \color{blue}{\tan z} + x \]
            3. lower-+.f6438.6

              \[\leadsto \color{blue}{\tan z + x} \]
          10. Applied egg-rr38.6%

            \[\leadsto \color{blue}{\tan z + x} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification51.6%

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

        Alternative 13: 50.0% accurate, 1.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y + z \leq -2 \cdot 10^{-11}:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - 0.3333333333333333 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{elif}\;y + z \leq 5 \cdot 10^{-29}:\\ \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \tan z\\ \end{array} \end{array} \]
        (FPCore (x y z a)
         :precision binary64
         (if (<= (+ y z) -2e-11)
           (+ x (- (tan (+ y z)) (* 0.3333333333333333 (* a (* a a)))))
           (if (<= (+ y z) 5e-29)
             (+ x (- (fma 0.3333333333333333 (* z (* z z)) z) (tan a)))
             (+ x (tan z)))))
        double code(double x, double y, double z, double a) {
        	double tmp;
        	if ((y + z) <= -2e-11) {
        		tmp = x + (tan((y + z)) - (0.3333333333333333 * (a * (a * a))));
        	} else if ((y + z) <= 5e-29) {
        		tmp = x + (fma(0.3333333333333333, (z * (z * z)), z) - tan(a));
        	} else {
        		tmp = x + tan(z);
        	}
        	return tmp;
        }
        
        function code(x, y, z, a)
        	tmp = 0.0
        	if (Float64(y + z) <= -2e-11)
        		tmp = Float64(x + Float64(tan(Float64(y + z)) - Float64(0.3333333333333333 * Float64(a * Float64(a * a)))));
        	elseif (Float64(y + z) <= 5e-29)
        		tmp = Float64(x + Float64(fma(0.3333333333333333, Float64(z * Float64(z * z)), z) - tan(a)));
        	else
        		tmp = Float64(x + tan(z));
        	end
        	return tmp
        end
        
        code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -2e-11], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(0.3333333333333333 * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 5e-29], N[(x + N[(N[(0.3333333333333333 * N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Tan[z], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y + z \leq -2 \cdot 10^{-11}:\\
        \;\;\;\;x + \left(\tan \left(y + z\right) - 0.3333333333333333 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\
        
        \mathbf{elif}\;y + z \leq 5 \cdot 10^{-29}:\\
        \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \tan z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 y z) < -1.99999999999999988e-11

          1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x + \left(\tan \left(y + z\right) - \frac{1}{3} \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) \]
            6. lower-*.f6439.9

              \[\leadsto x + \left(\tan \left(y + z\right) - 0.3333333333333333 \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) \]
          8. Simplified39.9%

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

          if -1.99999999999999988e-11 < (+.f64 y z) < 4.99999999999999986e-29

          1. Initial program 99.6%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6499.6

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          5. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 4.99999999999999986e-29 < (+.f64 y z)

          1. Initial program 73.7%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6451.4

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          5. Simplified51.4%

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

            \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
            4. lower-sin.f64N/A

              \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
            5. lower-cos.f6438.6

              \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
          8. Simplified38.6%

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          9. Step-by-step derivation
            1. tan-quotN/A

              \[\leadsto \color{blue}{\tan z} + x \]
            2. lift-tan.f64N/A

              \[\leadsto \color{blue}{\tan z} + x \]
            3. lower-+.f6438.6

              \[\leadsto \color{blue}{\tan z + x} \]
          10. Applied egg-rr38.6%

            \[\leadsto \color{blue}{\tan z + x} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification51.5%

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

        Alternative 14: 45.2% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{-47}:\\ \;\;\;\;\frac{1}{\frac{1}{x}}\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-9}:\\ \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \tan z\\ \end{array} \end{array} \]
        (FPCore (x y z a)
         :precision binary64
         (if (<= z -2.15e-47)
           (/ 1.0 (/ 1.0 x))
           (if (<= z 1.45e-9)
             (+ x (- (fma 0.3333333333333333 (* z (* z z)) z) (tan a)))
             (+ x (tan z)))))
        double code(double x, double y, double z, double a) {
        	double tmp;
        	if (z <= -2.15e-47) {
        		tmp = 1.0 / (1.0 / x);
        	} else if (z <= 1.45e-9) {
        		tmp = x + (fma(0.3333333333333333, (z * (z * z)), z) - tan(a));
        	} else {
        		tmp = x + tan(z);
        	}
        	return tmp;
        }
        
        function code(x, y, z, a)
        	tmp = 0.0
        	if (z <= -2.15e-47)
        		tmp = Float64(1.0 / Float64(1.0 / x));
        	elseif (z <= 1.45e-9)
        		tmp = Float64(x + Float64(fma(0.3333333333333333, Float64(z * Float64(z * z)), z) - tan(a)));
        	else
        		tmp = Float64(x + tan(z));
        	end
        	return tmp
        end
        
        code[x_, y_, z_, a_] := If[LessEqual[z, -2.15e-47], N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-9], N[(x + N[(N[(0.3333333333333333 * N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Tan[z], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -2.15 \cdot 10^{-47}:\\
        \;\;\;\;\frac{1}{\frac{1}{x}}\\
        
        \mathbf{elif}\;z \leq 1.45 \cdot 10^{-9}:\\
        \;\;\;\;x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \left(z \cdot z\right), z\right) - \tan a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \tan z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -2.1499999999999999e-47

          1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
          7. Simplified23.4%

            \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]

          if -2.1499999999999999e-47 < z < 1.44999999999999996e-9

          1. Initial program 99.4%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6461.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x + \left(\mathsf{fma}\left(0.3333333333333333, z \cdot \color{blue}{\left(z \cdot z\right)}, z\right) - \tan a\right) \]
          8. Simplified61.2%

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

          if 1.44999999999999996e-9 < z

          1. Initial program 58.2%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6458.2

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

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

            \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
            4. lower-sin.f64N/A

              \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
            5. lower-cos.f6440.1

              \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
          8. Simplified40.1%

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          9. Step-by-step derivation
            1. tan-quotN/A

              \[\leadsto \color{blue}{\tan z} + x \]
            2. lift-tan.f64N/A

              \[\leadsto \color{blue}{\tan z} + x \]
            3. lower-+.f6440.1

              \[\leadsto \color{blue}{\tan z + x} \]
          10. Applied egg-rr40.1%

            \[\leadsto \color{blue}{\tan z + x} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification43.9%

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

        Alternative 15: 41.1% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ x + \tan z \end{array} \]
        (FPCore (x y z a) :precision binary64 (+ x (tan z)))
        double code(double x, double y, double z, double a) {
        	return x + tan(z);
        }
        
        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(z)
        end function
        
        public static double code(double x, double y, double z, double a) {
        	return x + Math.tan(z);
        }
        
        def code(x, y, z, a):
        	return x + math.tan(z)
        
        function code(x, y, z, a)
        	return Float64(x + tan(z))
        end
        
        function tmp = code(x, y, z, a)
        	tmp = x + tan(z);
        end
        
        code[x_, y_, z_, a_] := N[(x + N[Tan[z], $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        x + \tan z
        \end{array}
        
        Derivation
        1. Initial program 78.4%

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

          \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
        4. 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.f6461.3

            \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
        5. Simplified61.3%

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

          \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          2. lower-+.f64N/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
          4. lower-sin.f64N/A

            \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
          5. lower-cos.f6440.0

            \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
        8. Simplified40.0%

          \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
        9. Step-by-step derivation
          1. tan-quotN/A

            \[\leadsto \color{blue}{\tan z} + x \]
          2. lift-tan.f64N/A

            \[\leadsto \color{blue}{\tan z} + x \]
          3. lower-+.f6440.0

            \[\leadsto \color{blue}{\tan z + x} \]
        10. Applied egg-rr40.0%

          \[\leadsto \color{blue}{\tan z + x} \]
        11. Final simplification40.0%

          \[\leadsto x + \tan z \]
        12. Add Preprocessing

        Alternative 16: 23.8% accurate, 8.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 9:\\ \;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, z \cdot 0.3333333333333333, 1\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;x + a \cdot \left(\left(a \cdot a\right) \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
        (FPCore (x y z a)
         :precision binary64
         (if (<= z 9.0)
           (fma z (fma z (* z 0.3333333333333333) 1.0) x)
           (+ x (* a (* (* a a) -0.3333333333333333)))))
        double code(double x, double y, double z, double a) {
        	double tmp;
        	if (z <= 9.0) {
        		tmp = fma(z, fma(z, (z * 0.3333333333333333), 1.0), x);
        	} else {
        		tmp = x + (a * ((a * a) * -0.3333333333333333));
        	}
        	return tmp;
        }
        
        function code(x, y, z, a)
        	tmp = 0.0
        	if (z <= 9.0)
        		tmp = fma(z, fma(z, Float64(z * 0.3333333333333333), 1.0), x);
        	else
        		tmp = Float64(x + Float64(a * Float64(Float64(a * a) * -0.3333333333333333)));
        	end
        	return tmp
        end
        
        code[x_, y_, z_, a_] := If[LessEqual[z, 9.0], N[(z * N[(z * N[(z * 0.3333333333333333), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(a * N[(N[(a * a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq 9:\\
        \;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(z, z \cdot 0.3333333333333333, 1\right), x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + a \cdot \left(\left(a \cdot a\right) \cdot -0.3333333333333333\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < 9

          1. Initial program 86.1%

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

            \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
          4. 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.f6462.6

              \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
          5. Simplified62.6%

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

            \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
            4. lower-sin.f64N/A

              \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
            5. lower-cos.f6440.3

              \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
          8. Simplified40.3%

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          9. Taylor expanded in z around 0

            \[\leadsto \color{blue}{x + z \cdot \left(1 + \frac{1}{3} \cdot {z}^{2}\right)} \]
          10. Step-by-step derivation
            1. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{3} \cdot {z}^{2} + 1}, x\right) \]
            4. *-commutativeN/A

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

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(z \cdot z\right)} \cdot \frac{1}{3} + 1, x\right) \]
            6. associate-*l*N/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{z \cdot \left(z \cdot \frac{1}{3}\right)} + 1, x\right) \]
            7. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, z \cdot \frac{1}{3}, 1\right)}, x\right) \]
            8. lower-*.f6426.1

              \[\leadsto \mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot 0.3333333333333333}, 1\right), x\right) \]
          11. Simplified26.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, z \cdot 0.3333333333333333, 1\right), x\right)} \]

          if 9 < z

          1. Initial program 57.6%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x + \color{blue}{\frac{-1}{3} \cdot {a}^{3}} \]
          7. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto x + \color{blue}{{a}^{3} \cdot \frac{-1}{3}} \]
            2. cube-multN/A

              \[\leadsto x + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot \frac{-1}{3} \]
            3. unpow2N/A

              \[\leadsto x + \left(a \cdot \color{blue}{{a}^{2}}\right) \cdot \frac{-1}{3} \]
            4. associate-*l*N/A

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

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

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

              \[\leadsto x + a \cdot \color{blue}{\left(\frac{-1}{3} \cdot {a}^{2}\right)} \]
            8. unpow2N/A

              \[\leadsto x + a \cdot \left(\frac{-1}{3} \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
            9. lower-*.f6413.7

              \[\leadsto x + a \cdot \left(-0.3333333333333333 \cdot \color{blue}{\left(a \cdot a\right)}\right) \]
          8. Simplified13.7%

            \[\leadsto x + \color{blue}{a \cdot \left(-0.3333333333333333 \cdot \left(a \cdot a\right)\right)} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification22.7%

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

        Alternative 17: 31.5% accurate, 9.1× speedup?

        \[\begin{array}{l} \\ \frac{1}{\frac{1}{x}} \end{array} \]
        (FPCore (x y z a) :precision binary64 (/ 1.0 (/ 1.0 x)))
        double code(double x, double y, double z, double a) {
        	return 1.0 / (1.0 / x);
        }
        
        real(8) function code(x, y, z, a)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: a
            code = 1.0d0 / (1.0d0 / x)
        end function
        
        public static double code(double x, double y, double z, double a) {
        	return 1.0 / (1.0 / x);
        }
        
        def code(x, y, z, a):
        	return 1.0 / (1.0 / x)
        
        function code(x, y, z, a)
        	return Float64(1.0 / Float64(1.0 / x))
        end
        
        function tmp = code(x, y, z, a)
        	tmp = 1.0 / (1.0 / x);
        end
        
        code[x_, y_, z_, a_] := N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \frac{1}{\frac{1}{x}}
        \end{array}
        
        Derivation
        1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
        7. Simplified30.7%

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

        Alternative 18: 21.9% accurate, 52.5× speedup?

        \[\begin{array}{l} \\ x + z \end{array} \]
        (FPCore (x y z a) :precision binary64 (+ x z))
        double code(double x, double y, double z, double a) {
        	return x + z;
        }
        
        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 + z
        end function
        
        public static double code(double x, double y, double z, double a) {
        	return x + z;
        }
        
        def code(x, y, z, a):
        	return x + z
        
        function code(x, y, z, a)
        	return Float64(x + z)
        end
        
        function tmp = code(x, y, z, a)
        	tmp = x + z;
        end
        
        code[x_, y_, z_, a_] := N[(x + z), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        x + z
        \end{array}
        
        Derivation
        1. Initial program 78.4%

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

          \[\leadsto x + \left(\color{blue}{\frac{\sin z}{\cos z}} - \tan a\right) \]
        4. 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.f6461.3

            \[\leadsto x + \left(\frac{\sin z}{\color{blue}{\cos z}} - \tan a\right) \]
        5. Simplified61.3%

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

          \[\leadsto \color{blue}{x + \frac{\sin z}{\cos z}} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          2. lower-+.f64N/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\sin z}{\cos z}} + x \]
          4. lower-sin.f64N/A

            \[\leadsto \frac{\color{blue}{\sin z}}{\cos z} + x \]
          5. lower-cos.f6440.0

            \[\leadsto \frac{\sin z}{\color{blue}{\cos z}} + x \]
        8. Simplified40.0%

          \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + x} \]
        9. Taylor expanded in z around 0

          \[\leadsto \color{blue}{x + z} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{z + x} \]
          2. lower-+.f6420.5

            \[\leadsto \color{blue}{z + x} \]
        11. Simplified20.5%

          \[\leadsto \color{blue}{z + x} \]
        12. Final simplification20.5%

          \[\leadsto x + z \]
        13. Add Preprocessing

        Reproduce

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