tan-example (used to crash)

Percentage Accurate: 79.7% → 99.7%
Time: 32.0s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 79.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.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 80.7%

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

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

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

Alternative 2: 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.02:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, t\_0, x - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\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.02)
     t_1
     (if (<= (tan a) 1e-14)
       (fma
        (/ 1.0 (fma (tan y) (- (tan z)) 1.0))
        t_0
        (- x (fma (* a a) (* a 0.3333333333333333) 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.02) {
		tmp = t_1;
	} else if (tan(a) <= 1e-14) {
		tmp = fma((1.0 / fma(tan(y), -tan(z), 1.0)), t_0, (x - fma((a * a), (a * 0.3333333333333333), 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.02)
		tmp = t_1;
	elseif (tan(a) <= 1e-14)
		tmp = fma(Float64(1.0 / fma(tan(y), Float64(-tan(z)), 1.0)), t_0, Float64(x - fma(Float64(a * a), Float64(a * 0.3333333333333333), 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.02], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 1e-14], N[(N[(1.0 / N[(N[Tan[y], $MachinePrecision] * (-N[Tan[z], $MachinePrecision]) + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(x - N[(N[(a * a), $MachinePrecision] * N[(a * 0.3333333333333333), $MachinePrecision] + a), $MachinePrecision]), $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.02:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (tan.f64 a) < -0.0200000000000000004 or 9.99999999999999999e-15 < (tan.f64 a)

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\tan \color{blue}{\left(y + z\right)} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
      8. 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) \]
      9. lift-tan.f64N/A

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

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

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

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

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

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

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1 - \tan y \cdot \tan z}} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
      16. 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) \]
      17. 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) \]
      18. 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)} \]
    6. Applied rewrites99.6%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, \tan y + \tan z, -\tan a\right)} \]
    7. 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) \]
    8. Step-by-step derivation
      1. Applied rewrites81.9%

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

      if -0.0200000000000000004 < (tan.f64 a) < 9.99999999999999999e-15

      1. Initial program 80.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-*.f6480.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. Applied rewrites80.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 rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, \tan y + \tan z, \left(-\mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right) + x\right)} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification90.8%

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

    Alternative 3: 89.2% 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.02:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 10^{-14}:\\ \;\;\;\;x + \left(\frac{t\_0}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)} - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\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.02)
         t_1
         (if (<= (tan a) 1e-14)
           (+
            x
            (-
             (/ t_0 (fma (tan y) (- (tan z)) 1.0))
             (fma (* a a) (* a 0.3333333333333333) 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.02) {
    		tmp = t_1;
    	} else if (tan(a) <= 1e-14) {
    		tmp = x + ((t_0 / fma(tan(y), -tan(z), 1.0)) - fma((a * a), (a * 0.3333333333333333), 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.02)
    		tmp = t_1;
    	elseif (tan(a) <= 1e-14)
    		tmp = Float64(x + Float64(Float64(t_0 / fma(tan(y), Float64(-tan(z)), 1.0)) - fma(Float64(a * a), Float64(a * 0.3333333333333333), 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.02], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 1e-14], N[(x + N[(N[(t$95$0 / N[(N[Tan[y], $MachinePrecision] * (-N[Tan[z], $MachinePrecision]) + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * a), $MachinePrecision] * N[(a * 0.3333333333333333), $MachinePrecision] + a), $MachinePrecision]), $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.02:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;\tan a \leq 10^{-14}:\\
    \;\;\;\;x + \left(\frac{t\_0}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)} - \mathsf{fma}\left(a \cdot a, a \cdot 0.3333333333333333, a\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (tan.f64 a) < -0.0200000000000000004 or 9.99999999999999999e-15 < (tan.f64 a)

      1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \left(\tan \color{blue}{\left(y + z\right)} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
        8. 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) \]
        9. lift-tan.f64N/A

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

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

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

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

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

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

          \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1 - \tan y \cdot \tan z}} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
        16. 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) \]
        17. 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) \]
        18. 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)} \]
      6. Applied rewrites99.6%

        \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, \tan y + \tan z, -\tan a\right)} \]
      7. 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) \]
      8. Step-by-step derivation
        1. Applied rewrites81.9%

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

        if -0.0200000000000000004 < (tan.f64 a) < 9.99999999999999999e-15

        1. Initial program 80.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-*.f6480.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. Applied rewrites80.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. tan-sumN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 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.02:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 10^{-14}:\\ \;\;\;\;\frac{t\_0}{1 - \tan y \cdot \tan z} + \left(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.02)
           t_1
           (if (<= (tan a) 1e-14)
             (+ (/ t_0 (- 1.0 (* (tan y) (tan z)))) (- 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.02) {
      		tmp = t_1;
      	} else if (tan(a) <= 1e-14) {
      		tmp = (t_0 / (1.0 - (tan(y) * tan(z)))) + (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.02)
      		tmp = t_1;
      	elseif (tan(a) <= 1e-14)
      		tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))) + 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.02], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 1e-14], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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.02:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;\tan a \leq 10^{-14}:\\
      \;\;\;\;\frac{t\_0}{1 - \tan y \cdot \tan z} + \left(x - a\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (tan.f64 a) < -0.0200000000000000004 or 9.99999999999999999e-15 < (tan.f64 a)

        1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

            \[\leadsto x + \left(\tan \color{blue}{\left(y + z\right)} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
          8. 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) \]
          9. lift-tan.f64N/A

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

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

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

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

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

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

            \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1 - \tan y \cdot \tan z}} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
          16. 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) \]
          17. 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) \]
          18. 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)} \]
        6. Applied rewrites99.6%

          \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, \tan y + \tan z, -\tan a\right)} \]
        7. 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) \]
        8. Step-by-step derivation
          1. Applied rewrites81.9%

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

          if -0.0200000000000000004 < (tan.f64 a) < 9.99999999999999999e-15

          1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
            12. unsub-negN/A

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - a\right)} \]
            13. lower--.f6480.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 80.1% 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 80.7%

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

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

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

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

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

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

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

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

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

            \[\leadsto x + \left(\tan \color{blue}{\left(y + z\right)} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
          8. 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) \]
          9. lift-tan.f64N/A

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

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

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

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

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

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

            \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{1 - \tan y \cdot \tan z}} + \left(\mathsf{neg}\left(\tan a\right)\right)\right) \]
          16. 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) \]
          17. 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) \]
          18. 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)} \]
        6. Applied rewrites99.7%

          \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{fma}\left(\tan y, -\tan z, 1\right)}, \tan y + \tan z, -\tan a\right)} \]
        7. 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) \]
        8. Step-by-step derivation
          1. Applied rewrites81.1%

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

          Alternative 6: 69.7% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \left(\tan z - \tan a\right)\\ \mathbf{if}\;a \leq -1.9 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.6:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \mathsf{fma}\left(a \cdot a, 0.05396825396825397, 0.13333333333333333\right), 0.3333333333333333\right), a \cdot \left(a \cdot a\right), 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 (<= a -1.9e-8)
               t_0
               (if (<= a 0.6)
                 (+
                  x
                  (-
                   (tan (+ y z))
                   (fma
                    (fma
                     a
                     (* a (fma (* a a) 0.05396825396825397 0.13333333333333333))
                     0.3333333333333333)
                    (* a (* a a))
                    a)))
                 t_0))))
          double code(double x, double y, double z, double a) {
          	double t_0 = x + (tan(z) - tan(a));
          	double tmp;
          	if (a <= -1.9e-8) {
          		tmp = t_0;
          	} else if (a <= 0.6) {
          		tmp = x + (tan((y + z)) - fma(fma(a, (a * fma((a * a), 0.05396825396825397, 0.13333333333333333)), 0.3333333333333333), (a * (a * a)), 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 (a <= -1.9e-8)
          		tmp = t_0;
          	elseif (a <= 0.6)
          		tmp = Float64(x + Float64(tan(Float64(y + z)) - fma(fma(a, Float64(a * fma(Float64(a * a), 0.05396825396825397, 0.13333333333333333)), 0.3333333333333333), Float64(a * Float64(a * a)), 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[a, -1.9e-8], t$95$0, If[LessEqual[a, 0.6], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[(N[(a * N[(a * N[(N[(a * a), $MachinePrecision] * 0.05396825396825397 + 0.13333333333333333), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(a * N[(a * a), $MachinePrecision]), $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}\;a \leq -1.9 \cdot 10^{-8}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;a \leq 0.6:\\
          \;\;\;\;x + \left(\tan \left(y + z\right) - \mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \mathsf{fma}\left(a \cdot a, 0.05396825396825397, 0.13333333333333333\right), 0.3333333333333333\right), a \cdot \left(a \cdot a\right), a\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if a < -1.90000000000000014e-8 or 0.599999999999999978 < a

            1. Initial program 80.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.f6459.6

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

              \[\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-+.f6459.6

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

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

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

            if -1.90000000000000014e-8 < a < 0.599999999999999978

            1. Initial program 80.9%

              \[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 + {a}^{2} \cdot \left(\frac{1}{3} + {a}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {a}^{2}\right)\right)\right)}\right) \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

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

                \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\mathsf{fma}\left(\frac{1}{3} + {a}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {a}^{2}\right), a \cdot {a}^{2}, a\right)}\right) \]
            5. Applied rewrites80.3%

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

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

          Alternative 7: 79.7% accurate, 1.0× speedup?

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

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

          Alternative 8: 55.1% accurate, 1.3× speedup?

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

            1. Initial program 79.9%

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

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

              \[\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 + {z}^{2} \cdot \left(\frac{1}{3} + {z}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {z}^{2}\right)\right)\right)} - \tan a\right) \]
            7. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

                \[\leadsto x + \left(\color{blue}{\mathsf{fma}\left(\frac{1}{3} + {z}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {z}^{2}\right), {z}^{2} \cdot z, z\right)} - \tan a\right) \]
            8. Applied rewrites29.2%

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

            if -5.2e11 < a < 1.3999999999999999

            1. Initial program 80.2%

              \[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 + {a}^{2} \cdot \left(\frac{1}{3} + {a}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {a}^{2}\right)\right)\right)}\right) \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

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

                \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\mathsf{fma}\left(\frac{1}{3} + {a}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {a}^{2}\right), a \cdot {a}^{2}, a\right)}\right) \]
            5. Applied rewrites78.7%

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

            if 1.3999999999999999 < a

            1. Initial program 82.0%

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

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

              \[\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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

                \[\leadsto x + \left(\mathsf{fma}\left(\frac{1}{3}, z \cdot \color{blue}{{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-*.f6436.1

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

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

          Alternative 9: 55.1% accurate, 1.4× speedup?

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

            1. Initial program 79.9%

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

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

              \[\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 + {z}^{2} \cdot \left(\frac{1}{3} + {z}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {z}^{2}\right)\right)\right)} - \tan a\right) \]
            7. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

                \[\leadsto x + \left(\color{blue}{\mathsf{fma}\left(\frac{1}{3} + {z}^{2} \cdot \left(\frac{2}{15} + \frac{17}{315} \cdot {z}^{2}\right), {z}^{2} \cdot z, z\right)} - \tan a\right) \]
            8. Applied rewrites29.2%

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

            if -5.2e11 < a < 1.30000000000000004

            1. Initial program 80.2%

              \[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 + {a}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)\right)}\right) \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

                \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\left(a \cdot \left({a}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)\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 {a}^{2}\right) \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)} + a \cdot 1\right)\right) \]
              4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1.30000000000000004 < a

            1. Initial program 82.0%

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

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

              \[\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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

                \[\leadsto x + \left(\mathsf{fma}\left(\frac{1}{3}, z \cdot \color{blue}{{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-*.f6436.1

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

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

          Alternative 10: 55.1% accurate, 1.4× speedup?

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

            1. Initial program 79.9%

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

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

              \[\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 + {z}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {z}^{2}\right)\right)} - \tan a\right) \]
            7. Step-by-step derivation
              1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -5.2e11 < a < 1.30000000000000004

            1. Initial program 80.2%

              \[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 + {a}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)\right)}\right) \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

                \[\leadsto x + \left(\tan \left(y + z\right) - \color{blue}{\left(a \cdot \left({a}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)\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 {a}^{2}\right) \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {a}^{2}\right)} + a \cdot 1\right)\right) \]
              4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1.30000000000000004 < a

            1. Initial program 82.0%

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

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

              \[\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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

                \[\leadsto x + \left(\mathsf{fma}\left(\frac{1}{3}, z \cdot \color{blue}{{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-*.f6436.1

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

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

          Alternative 11: 54.6% accurate, 1.5× speedup?

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

            1. Initial program 79.9%

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

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

              \[\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 + {z}^{2} \cdot \left(\frac{1}{3} + \frac{2}{15} \cdot {z}^{2}\right)\right)} - \tan a\right) \]
            7. Step-by-step derivation
              1. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -5.2e11 < a < 1.4e17

            1. Initial program 79.5%

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

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

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

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

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

                \[\leadsto x + \left(\tan \color{blue}{\left(\mathsf{fma}\left(y, \frac{z}{y}, y\right)\right)} - \tan a\right) \]
              5. lower-/.f6467.6

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
              12. unsub-negN/A

                \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - a\right)} \]
              13. lower--.f6476.8

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

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

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

            if 1.4e17 < a

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

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

              \[\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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

                \[\leadsto x + \left(\mathsf{fma}\left(\frac{1}{3}, z \cdot \color{blue}{{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-*.f6437.2

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

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

          Alternative 12: 54.6% accurate, 1.6× speedup?

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

            1. Initial program 81.9%

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

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

              \[\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. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

                \[\leadsto x + \left(\mathsf{fma}\left(\frac{1}{3}, z \cdot \color{blue}{{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-*.f6433.7

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

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

            if -5.2e11 < a < 1.4e17

            1. Initial program 79.5%

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

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

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

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

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

                \[\leadsto x + \left(\tan \color{blue}{\left(\mathsf{fma}\left(y, \frac{z}{y}, y\right)\right)} - \tan a\right) \]
              5. lower-/.f6467.6

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
              12. unsub-negN/A

                \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - a\right)} \]
              13. lower--.f6476.8

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

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

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

          Alternative 13: 40.9% accurate, 1.9× speedup?

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

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

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

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

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

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

              \[\leadsto x + \left(\tan \color{blue}{\left(\mathsf{fma}\left(y, \frac{z}{y}, y\right)\right)} - \tan a\right) \]
            5. lower-/.f6465.9

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
            12. unsub-negN/A

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - a\right)} \]
            13. lower--.f6441.5

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

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

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

          Alternative 14: 21.5% accurate, 11.1× speedup?

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

            \[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-*.f6441.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. Applied rewrites41.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 + \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. *-commutativeN/A

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

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

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

              \[\leadsto x + a \cdot \color{blue}{\left(a \cdot \left(a \cdot \frac{-1}{3}\right)\right)} \]
            11. lower-*.f6422.0

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

            \[\leadsto x + \color{blue}{a \cdot \left(a \cdot \left(a \cdot -0.3333333333333333\right)\right)} \]
          9. Add Preprocessing

          Alternative 15: 3.5% accurate, 70.0× speedup?

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

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

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

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

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

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

              \[\leadsto x + \left(\tan \color{blue}{\left(\mathsf{fma}\left(y, \frac{z}{y}, y\right)\right)} - \tan a\right) \]
            5. lower-/.f6465.9

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right) \]
            12. unsub-negN/A

              \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - a\right)} \]
            13. lower--.f6441.5

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

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

            \[\leadsto \color{blue}{-1 \cdot a} \]
          10. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \color{blue}{\mathsf{neg}\left(a\right)} \]
            2. lower-neg.f643.4

              \[\leadsto \color{blue}{-a} \]
          11. Applied rewrites3.4%

            \[\leadsto \color{blue}{-a} \]
          12. Add Preprocessing

          Reproduce

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