tan-example (used to crash)

Percentage Accurate: 79.1% → 99.7%
Time: 23.3s
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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ x + \left(\frac{\tan y + \tan z}{1 - \frac{\tan z}{\frac{\cos y}{\sin y}}} - \tan a\right) \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (+
  x
  (- (/ (+ (tan y) (tan z)) (- 1.0 (/ (tan z) (/ (cos y) (sin y))))) (tan a))))
double code(double x, double y, double z, double a) {
	return x + (((tan(y) + tan(z)) / (1.0 - (tan(z) / (cos(y) / sin(y))))) - 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(z) / (cos(y) / sin(y))))) - 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(z) / (Math.cos(y) / Math.sin(y))))) - Math.tan(a));
}
def code(x, y, z, a):
	return x + (((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(z) / (math.cos(y) / math.sin(y))))) - math.tan(a))
function code(x, y, z, a)
	return Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(z) / Float64(cos(y) / sin(y))))) - tan(a)))
end
function tmp = code(x, y, z, a)
	tmp = x + (((tan(y) + tan(z)) / (1.0 - (tan(z) / (cos(y) / sin(y))))) - 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[z], $MachinePrecision] / N[(N[Cos[y], $MachinePrecision] / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(\frac{\tan y + \tan z}{1 - \frac{\tan z}{\frac{\cos y}{\sin y}}} - \tan a\right)
\end{array}
Derivation
  1. Initial program 76.3%

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

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

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    5. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. tan-lowering-tan.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  4. Applied egg-rr99.7%

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    2. tan-quotN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    3. clear-numN/A

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    5. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    7. clear-numN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. tan-quotN/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    10. tan-lowering-tan.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  6. Applied egg-rr99.7%

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

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\cos y, \sin y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    2. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(y\right), \sin y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    3. sin-lowering-sin.f6499.7%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(y\right), \mathsf{sin.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
  9. Simplified99.7%

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

Alternative 2: 88.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-50}:\\ \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - \left(y \cdot y\right) \cdot \left(-0.3333333333333333 + \left(y \cdot y\right) \cdot \left(-0.022222222222222223 + y \cdot \left(y \cdot -0.0021164021164021165\right)\right)\right)}{y}}} - \tan a\right)\\ \end{array} \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))))
   (if (<= (tan a) -1e-16)
     (+
      x
      (-
       (/
        t_0
        (+ 1.0 (/ (tan z) (/ (- -1.0 (* -0.3333333333333333 (* y y))) y))))
       (tan a)))
     (if (<= (tan a) 5e-50)
       (+ x (/ t_0 (- 1.0 (* (tan y) (tan z)))))
       (+
        x
        (-
         (/
          t_0
          (+
           1.0
           (/
            (tan z)
            (/
             (-
              -1.0
              (*
               (* y y)
               (+
                -0.3333333333333333
                (*
                 (* y y)
                 (+
                  -0.022222222222222223
                  (* y (* y -0.0021164021164021165)))))))
             y))))
         (tan a)))))))
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double tmp;
	if (tan(a) <= -1e-16) {
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	} else if (tan(a) <= 5e-50) {
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	} else {
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + ((y * y) * (-0.022222222222222223 + (y * (y * -0.0021164021164021165))))))) / y)))) - tan(a));
	}
	return tmp;
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    if (tan(a) <= (-1d-16)) then
        tmp = x + ((t_0 / (1.0d0 + (tan(z) / (((-1.0d0) - ((-0.3333333333333333d0) * (y * y))) / y)))) - tan(a))
    else if (tan(a) <= 5d-50) then
        tmp = x + (t_0 / (1.0d0 - (tan(y) * tan(z))))
    else
        tmp = x + ((t_0 / (1.0d0 + (tan(z) / (((-1.0d0) - ((y * y) * ((-0.3333333333333333d0) + ((y * y) * ((-0.022222222222222223d0) + (y * (y * (-0.0021164021164021165d0)))))))) / y)))) - tan(a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double tmp;
	if (Math.tan(a) <= -1e-16) {
		tmp = x + ((t_0 / (1.0 + (Math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - Math.tan(a));
	} else if (Math.tan(a) <= 5e-50) {
		tmp = x + (t_0 / (1.0 - (Math.tan(y) * Math.tan(z))));
	} else {
		tmp = x + ((t_0 / (1.0 + (Math.tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + ((y * y) * (-0.022222222222222223 + (y * (y * -0.0021164021164021165))))))) / y)))) - Math.tan(a));
	}
	return tmp;
}
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	tmp = 0
	if math.tan(a) <= -1e-16:
		tmp = x + ((t_0 / (1.0 + (math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - math.tan(a))
	elif math.tan(a) <= 5e-50:
		tmp = x + (t_0 / (1.0 - (math.tan(y) * math.tan(z))))
	else:
		tmp = x + ((t_0 / (1.0 + (math.tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + ((y * y) * (-0.022222222222222223 + (y * (y * -0.0021164021164021165))))))) / y)))) - math.tan(a))
	return tmp
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	tmp = 0.0
	if (tan(a) <= -1e-16)
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 + Float64(tan(z) / Float64(Float64(-1.0 - Float64(-0.3333333333333333 * Float64(y * y))) / y)))) - tan(a)));
	elseif (tan(a) <= 5e-50)
		tmp = Float64(x + Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))));
	else
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 + Float64(tan(z) / Float64(Float64(-1.0 - Float64(Float64(y * y) * Float64(-0.3333333333333333 + Float64(Float64(y * y) * Float64(-0.022222222222222223 + Float64(y * Float64(y * -0.0021164021164021165))))))) / y)))) - tan(a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	tmp = 0.0;
	if (tan(a) <= -1e-16)
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	elseif (tan(a) <= 5e-50)
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	else
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + ((y * y) * (-0.022222222222222223 + (y * (y * -0.0021164021164021165))))))) / y)))) - tan(a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -1e-16], N[(x + N[(N[(t$95$0 / N[(1.0 + N[(N[Tan[z], $MachinePrecision] / N[(N[(-1.0 - N[(-0.3333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-50], N[(x + N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t$95$0 / N[(1.0 + N[(N[Tan[z], $MachinePrecision] / N[(N[(-1.0 - N[(N[(y * y), $MachinePrecision] * N[(-0.3333333333333333 + N[(N[(y * y), $MachinePrecision] * N[(-0.022222222222222223 + N[(y * N[(y * -0.0021164021164021165), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\

\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\

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


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

    1. Initial program 77.3%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\left(1 + \frac{-1}{3} \cdot {y}^{2}\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{3} \cdot {y}^{2}\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left({y}^{2}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left(y \cdot y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. *-lowering-*.f6477.8%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(y, y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. Simplified77.8%

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

    if -9.9999999999999998e-17 < (tan.f64 a) < 4.99999999999999968e-50

    1. Initial program 73.7%

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
      7. +-lowering-+.f6473.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
    5. Simplified73.7%

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

        \[\leadsto \mathsf{+.f64}\left(\tan \left(y + z\right), x\right) \]
      2. tan-sumN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), x\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      6. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), x\right) \]
      9. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), x\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), x\right) \]
    7. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} + x \]

    if 4.99999999999999968e-50 < (tan.f64 a)

    1. Initial program 80.0%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.5%

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \color{blue}{\left(\frac{1 + {y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{-2}{945} \cdot {y}^{2} - \frac{1}{45}\right) - \frac{1}{3}\right)}{y}\right)}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\left(1 + {y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{-2}{945} \cdot {y}^{2} - \frac{1}{45}\right) - \frac{1}{3}\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. Simplified82.4%

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

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

Alternative 3: 88.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-50}:\\ \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - \left(y \cdot y\right) \cdot \left(-0.3333333333333333 + y \cdot \left(y \cdot -0.022222222222222223\right)\right)}{y}}} - \tan a\right)\\ \end{array} \end{array} \]
(FPCore (x y z a)
 :precision binary64
 (let* ((t_0 (+ (tan y) (tan z))))
   (if (<= (tan a) -1e-16)
     (+
      x
      (-
       (/
        t_0
        (+ 1.0 (/ (tan z) (/ (- -1.0 (* -0.3333333333333333 (* y y))) y))))
       (tan a)))
     (if (<= (tan a) 5e-50)
       (+ x (/ t_0 (- 1.0 (* (tan y) (tan z)))))
       (+
        x
        (-
         (/
          t_0
          (+
           1.0
           (/
            (tan z)
            (/
             (-
              -1.0
              (*
               (* y y)
               (+ -0.3333333333333333 (* y (* y -0.022222222222222223)))))
             y))))
         (tan a)))))))
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double tmp;
	if (tan(a) <= -1e-16) {
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	} else if (tan(a) <= 5e-50) {
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	} else {
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + (y * (y * -0.022222222222222223))))) / y)))) - tan(a));
	}
	return tmp;
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    if (tan(a) <= (-1d-16)) then
        tmp = x + ((t_0 / (1.0d0 + (tan(z) / (((-1.0d0) - ((-0.3333333333333333d0) * (y * y))) / y)))) - tan(a))
    else if (tan(a) <= 5d-50) then
        tmp = x + (t_0 / (1.0d0 - (tan(y) * tan(z))))
    else
        tmp = x + ((t_0 / (1.0d0 + (tan(z) / (((-1.0d0) - ((y * y) * ((-0.3333333333333333d0) + (y * (y * (-0.022222222222222223d0)))))) / y)))) - tan(a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double tmp;
	if (Math.tan(a) <= -1e-16) {
		tmp = x + ((t_0 / (1.0 + (Math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - Math.tan(a));
	} else if (Math.tan(a) <= 5e-50) {
		tmp = x + (t_0 / (1.0 - (Math.tan(y) * Math.tan(z))));
	} else {
		tmp = x + ((t_0 / (1.0 + (Math.tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + (y * (y * -0.022222222222222223))))) / y)))) - Math.tan(a));
	}
	return tmp;
}
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	tmp = 0
	if math.tan(a) <= -1e-16:
		tmp = x + ((t_0 / (1.0 + (math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - math.tan(a))
	elif math.tan(a) <= 5e-50:
		tmp = x + (t_0 / (1.0 - (math.tan(y) * math.tan(z))))
	else:
		tmp = x + ((t_0 / (1.0 + (math.tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + (y * (y * -0.022222222222222223))))) / y)))) - math.tan(a))
	return tmp
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	tmp = 0.0
	if (tan(a) <= -1e-16)
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 + Float64(tan(z) / Float64(Float64(-1.0 - Float64(-0.3333333333333333 * Float64(y * y))) / y)))) - tan(a)));
	elseif (tan(a) <= 5e-50)
		tmp = Float64(x + Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))));
	else
		tmp = Float64(x + Float64(Float64(t_0 / Float64(1.0 + Float64(tan(z) / Float64(Float64(-1.0 - Float64(Float64(y * y) * Float64(-0.3333333333333333 + Float64(y * Float64(y * -0.022222222222222223))))) / y)))) - tan(a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	tmp = 0.0;
	if (tan(a) <= -1e-16)
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	elseif (tan(a) <= 5e-50)
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	else
		tmp = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - ((y * y) * (-0.3333333333333333 + (y * (y * -0.022222222222222223))))) / y)))) - tan(a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, a_] := Block[{t$95$0 = N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -1e-16], N[(x + N[(N[(t$95$0 / N[(1.0 + N[(N[Tan[z], $MachinePrecision] / N[(N[(-1.0 - N[(-0.3333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-50], N[(x + N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t$95$0 / N[(1.0 + N[(N[Tan[z], $MachinePrecision] / N[(N[(-1.0 - N[(N[(y * y), $MachinePrecision] * N[(-0.3333333333333333 + N[(y * N[(y * -0.022222222222222223), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
\mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\
\;\;\;\;x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\

\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\

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


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

    1. Initial program 77.3%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\left(1 + \frac{-1}{3} \cdot {y}^{2}\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{3} \cdot {y}^{2}\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left({y}^{2}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left(y \cdot y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. *-lowering-*.f6477.8%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(y, y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. Simplified77.8%

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

    if -9.9999999999999998e-17 < (tan.f64 a) < 4.99999999999999968e-50

    1. Initial program 73.7%

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
      7. +-lowering-+.f6473.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
    5. Simplified73.7%

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

        \[\leadsto \mathsf{+.f64}\left(\tan \left(y + z\right), x\right) \]
      2. tan-sumN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), x\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      6. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), x\right) \]
      9. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), x\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), x\right) \]
    7. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} + x \]

    if 4.99999999999999968e-50 < (tan.f64 a)

    1. Initial program 80.0%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.5%

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \color{blue}{\left(\frac{1 + {y}^{2} \cdot \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)}{y}\right)}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\left(1 + {y}^{2} \cdot \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left({y}^{2} \cdot \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({y}^{2}\right), \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(y \cdot y\right), \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\frac{-1}{45} \cdot {y}^{2} - \frac{1}{3}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\frac{-1}{45} \cdot {y}^{2} + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. metadata-evalN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(\frac{-1}{3} + \frac{-1}{45} \cdot {y}^{2}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\frac{-1}{45} \cdot {y}^{2}\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left({y}^{2} \cdot \frac{-1}{45}\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(\left(y \cdot y\right) \cdot \frac{-1}{45}\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \left(y \cdot \left(y \cdot \frac{-1}{45}\right)\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(y, \left(y \cdot \frac{-1}{45}\right)\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      14. *-lowering-*.f6482.3%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{+.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \frac{-1}{45}\right)\right)\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. Simplified82.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\ \;\;\;\;x + \left(\frac{\tan y + \tan z}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-50}:\\ \;\;\;\;x + \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{\tan y + \tan z}{1 + \frac{\tan z}{\frac{-1 - \left(y \cdot y\right) \cdot \left(-0.3333333333333333 + y \cdot \left(y \cdot -0.022222222222222223\right)\right)}{y}}} - \tan a\right)\\ \end{array} \]
  5. 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 + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\ \mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-15}:\\ \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\ \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
          (-
           (/
            t_0
            (+ 1.0 (/ (tan z) (/ (- -1.0 (* -0.3333333333333333 (* y y))) y))))
           (tan a)))))
   (if (<= (tan a) -1e-16)
     t_1
     (if (<= (tan a) 5e-15) (+ x (/ t_0 (- 1.0 (* (tan y) (tan z))))) t_1))))
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double t_1 = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	double tmp;
	if (tan(a) <= -1e-16) {
		tmp = t_1;
	} else if (tan(a) <= 5e-15) {
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    t_1 = x + ((t_0 / (1.0d0 + (tan(z) / (((-1.0d0) - ((-0.3333333333333333d0) * (y * y))) / y)))) - tan(a))
    if (tan(a) <= (-1d-16)) then
        tmp = t_1
    else if (tan(a) <= 5d-15) then
        tmp = x + (t_0 / (1.0d0 - (tan(y) * tan(z))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double t_1 = x + ((t_0 / (1.0 + (Math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - Math.tan(a));
	double tmp;
	if (Math.tan(a) <= -1e-16) {
		tmp = t_1;
	} else if (Math.tan(a) <= 5e-15) {
		tmp = x + (t_0 / (1.0 - (Math.tan(y) * Math.tan(z))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	t_1 = x + ((t_0 / (1.0 + (math.tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - math.tan(a))
	tmp = 0
	if math.tan(a) <= -1e-16:
		tmp = t_1
	elif math.tan(a) <= 5e-15:
		tmp = x + (t_0 / (1.0 - (math.tan(y) * math.tan(z))))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	t_1 = Float64(x + Float64(Float64(t_0 / Float64(1.0 + Float64(tan(z) / Float64(Float64(-1.0 - Float64(-0.3333333333333333 * Float64(y * y))) / y)))) - tan(a)))
	tmp = 0.0
	if (tan(a) <= -1e-16)
		tmp = t_1;
	elseif (tan(a) <= 5e-15)
		tmp = Float64(x + Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	t_1 = x + ((t_0 / (1.0 + (tan(z) / ((-1.0 - (-0.3333333333333333 * (y * y))) / y)))) - tan(a));
	tmp = 0.0;
	if (tan(a) <= -1e-16)
		tmp = t_1;
	elseif (tan(a) <= 5e-15)
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	else
		tmp = t_1;
	end
	tmp_2 = 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[(N[(t$95$0 / N[(1.0 + N[(N[Tan[z], $MachinePrecision] / N[(N[(-1.0 - N[(-0.3333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -1e-16], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 5e-15], N[(x + N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
t_1 := x + \left(\frac{t\_0}{1 + \frac{\tan z}{\frac{-1 - -0.3333333333333333 \cdot \left(y \cdot y\right)}{y}}} - \tan a\right)\\
\mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-15}:\\
\;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\

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


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

    1. Initial program 78.6%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.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. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.6%

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\left(1 + \frac{-1}{3} \cdot {y}^{2}\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{3} \cdot {y}^{2}\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left({y}^{2}\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \left(y \cdot y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. *-lowering-*.f6479.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{3}, \mathsf{*.f64}\left(y, y\right)\right)\right), y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    9. Simplified79.4%

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

    if -9.9999999999999998e-17 < (tan.f64 a) < 4.99999999999999999e-15

    1. Initial program 74.0%

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
      7. +-lowering-+.f6474.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
    5. Simplified74.0%

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

        \[\leadsto \mathsf{+.f64}\left(\tan \left(y + z\right), x\right) \]
      2. tan-sumN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), x\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      6. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), x\right) \]
      9. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), x\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), x\right) \]
    7. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} + x \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.4%

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

Alternative 5: 88.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan y + \tan z\\ t_1 := x + \left(t\_0 - \tan a\right)\\ \mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\tan a \leq 5 \cdot 10^{-15}:\\ \;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\ \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 (- t_0 (tan a)))))
   (if (<= (tan a) -1e-16)
     t_1
     (if (<= (tan a) 5e-15) (+ x (/ t_0 (- 1.0 (* (tan y) (tan z))))) t_1))))
double code(double x, double y, double z, double a) {
	double t_0 = tan(y) + tan(z);
	double t_1 = x + (t_0 - tan(a));
	double tmp;
	if (tan(a) <= -1e-16) {
		tmp = t_1;
	} else if (tan(a) <= 5e-15) {
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: a
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = tan(y) + tan(z)
    t_1 = x + (t_0 - tan(a))
    if (tan(a) <= (-1d-16)) then
        tmp = t_1
    else if (tan(a) <= 5d-15) then
        tmp = x + (t_0 / (1.0d0 - (tan(y) * tan(z))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double a) {
	double t_0 = Math.tan(y) + Math.tan(z);
	double t_1 = x + (t_0 - Math.tan(a));
	double tmp;
	if (Math.tan(a) <= -1e-16) {
		tmp = t_1;
	} else if (Math.tan(a) <= 5e-15) {
		tmp = x + (t_0 / (1.0 - (Math.tan(y) * Math.tan(z))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, a):
	t_0 = math.tan(y) + math.tan(z)
	t_1 = x + (t_0 - math.tan(a))
	tmp = 0
	if math.tan(a) <= -1e-16:
		tmp = t_1
	elif math.tan(a) <= 5e-15:
		tmp = x + (t_0 / (1.0 - (math.tan(y) * math.tan(z))))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, a)
	t_0 = Float64(tan(y) + tan(z))
	t_1 = Float64(x + Float64(t_0 - tan(a)))
	tmp = 0.0
	if (tan(a) <= -1e-16)
		tmp = t_1;
	elseif (tan(a) <= 5e-15)
		tmp = Float64(x + Float64(t_0 / Float64(1.0 - Float64(tan(y) * tan(z)))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, a)
	t_0 = tan(y) + tan(z);
	t_1 = x + (t_0 - tan(a));
	tmp = 0.0;
	if (tan(a) <= -1e-16)
		tmp = t_1;
	elseif (tan(a) <= 5e-15)
		tmp = x + (t_0 / (1.0 - (tan(y) * tan(z))));
	else
		tmp = t_1;
	end
	tmp_2 = 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[(t$95$0 - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -1e-16], t$95$1, If[LessEqual[N[Tan[a], $MachinePrecision], 5e-15], N[(x + N[(t$95$0 / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan y + \tan z\\
t_1 := x + \left(t\_0 - \tan a\right)\\
\mathbf{if}\;\tan a \leq -1 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-15}:\\
\;\;\;\;x + \frac{t\_0}{1 - \tan y \cdot \tan z}\\

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


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

    1. Initial program 78.6%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.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. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.6%

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \color{blue}{1}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified79.3%

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

      if -9.9999999999999998e-17 < (tan.f64 a) < 4.99999999999999999e-15

      1. Initial program 74.0%

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

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

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
        6. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
        7. +-lowering-+.f6474.0%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
      5. Simplified74.0%

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

          \[\leadsto \mathsf{+.f64}\left(\tan \left(y + z\right), x\right) \]
        2. tan-sumN/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\right), x\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\tan y + \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
        5. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
        6. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), x\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), x\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), x\right) \]
        9. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), x\right) \]
        10. tan-lowering-tan.f6499.7%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), x\right) \]
      7. Applied egg-rr99.7%

        \[\leadsto \color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} + x \]
    9. Recombined 2 regimes into one program.
    10. Final simplification89.3%

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

    Alternative 7: 59.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x - \tan a\\ \mathbf{if}\;\tan a \leq -5 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\tan a \leq 0.02:\\ \;\;\;\;x + \tan \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z a)
     :precision binary64
     (let* ((t_0 (- x (tan a))))
       (if (<= (tan a) -5e-6) t_0 (if (<= (tan a) 0.02) (+ x (tan (+ y z))) t_0))))
    double code(double x, double y, double z, double a) {
    	double t_0 = x - tan(a);
    	double tmp;
    	if (tan(a) <= -5e-6) {
    		tmp = t_0;
    	} else if (tan(a) <= 0.02) {
    		tmp = x + tan((y + z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, a)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: a
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x - tan(a)
        if (tan(a) <= (-5d-6)) then
            tmp = t_0
        else if (tan(a) <= 0.02d0) then
            tmp = x + tan((y + z))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double a) {
    	double t_0 = x - Math.tan(a);
    	double tmp;
    	if (Math.tan(a) <= -5e-6) {
    		tmp = t_0;
    	} else if (Math.tan(a) <= 0.02) {
    		tmp = x + Math.tan((y + z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z, a):
    	t_0 = x - math.tan(a)
    	tmp = 0
    	if math.tan(a) <= -5e-6:
    		tmp = t_0
    	elif math.tan(a) <= 0.02:
    		tmp = x + math.tan((y + z))
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z, a)
    	t_0 = Float64(x - tan(a))
    	tmp = 0.0
    	if (tan(a) <= -5e-6)
    		tmp = t_0;
    	elseif (tan(a) <= 0.02)
    		tmp = Float64(x + tan(Float64(y + z)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, a)
    	t_0 = x - tan(a);
    	tmp = 0.0;
    	if (tan(a) <= -5e-6)
    		tmp = t_0;
    	elseif (tan(a) <= 0.02)
    		tmp = x + tan((y + z));
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Tan[a], $MachinePrecision], -5e-6], t$95$0, If[LessEqual[N[Tan[a], $MachinePrecision], 0.02], N[(x + N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x - \tan a\\
    \mathbf{if}\;\tan a \leq -5 \cdot 10^{-6}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;\tan a \leq 0.02:\\
    \;\;\;\;x + \tan \left(y + z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (tan.f64 a) < -5.00000000000000041e-6 or 0.0200000000000000004 < (tan.f64 a)

      1. Initial program 77.2%

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

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

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

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

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \cos y\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
        6. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
        7. --lowering--.f64N/A

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right)\right) \]
        9. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right)\right) \]
        10. cos-lowering-cos.f6460.9%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right)\right) \]
      5. Simplified60.9%

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

        \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
      7. Step-by-step derivation
        1. --lowering--.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right) \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right) \]
        4. cos-lowering-cos.f6445.5%

          \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right) \]
      8. Simplified45.5%

        \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
      9. Step-by-step derivation
        1. --lowering--.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
        2. tan-quotN/A

          \[\leadsto \mathsf{\_.f64}\left(x, \tan a\right) \]
        3. tan-lowering-tan.f6445.5%

          \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{tan.f64}\left(a\right)\right) \]
      10. Applied egg-rr45.5%

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

      if -5.00000000000000041e-6 < (tan.f64 a) < 0.0200000000000000004

      1. Initial program 75.5%

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

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

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
        6. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
        7. +-lowering-+.f6473.7%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
      5. Simplified73.7%

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

          \[\leadsto \tan \left(y + z\right) + x \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\tan \left(y + z\right), \color{blue}{x}\right) \]
        3. tan-lowering-tan.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{tan.f64}\left(\left(y + z\right)\right), x\right) \]
        4. +-lowering-+.f6473.7%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), x\right) \]
      7. Applied egg-rr73.7%

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

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

    Alternative 8: 79.4% accurate, 0.7× speedup?

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\tan y, \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      4. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \left(1 - \tan y \cdot \tan z\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan y \cdot \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\tan y, \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-lowering-tan.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \tan z\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \tan y\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      2. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\tan z \cdot \frac{\sin y}{\cos y}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \left(\frac{\tan z}{\frac{\cos y}{\sin y}}\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{\cos y}{\sin y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\frac{\sin y}{\cos y}}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      8. tan-quotN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \left(\frac{1}{\tan y}\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \tan y\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
      10. tan-lowering-tan.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{tan.f64}\left(z\right), \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(y\right)\right)\right)\right)\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    6. Applied egg-rr99.7%

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

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{tan.f64}\left(y\right), \mathsf{tan.f64}\left(z\right)\right), \color{blue}{1}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified77.0%

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

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

      Alternative 9: 59.2% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y + z \leq -2 \cdot 10^{-243}:\\ \;\;\;\;x + \left(\tan y - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan z - \tan a\right)\\ \end{array} \end{array} \]
      (FPCore (x y z a)
       :precision binary64
       (if (<= (+ y z) -2e-243) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
      double code(double x, double y, double z, double a) {
      	double tmp;
      	if ((y + z) <= -2e-243) {
      		tmp = x + (tan(y) - tan(a));
      	} else {
      		tmp = x + (tan(z) - tan(a));
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z, a)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8), intent (in) :: a
          real(8) :: tmp
          if ((y + z) <= (-2d-243)) then
              tmp = x + (tan(y) - tan(a))
          else
              tmp = x + (tan(z) - tan(a))
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z, double a) {
      	double tmp;
      	if ((y + z) <= -2e-243) {
      		tmp = x + (Math.tan(y) - Math.tan(a));
      	} else {
      		tmp = x + (Math.tan(z) - Math.tan(a));
      	}
      	return tmp;
      }
      
      def code(x, y, z, a):
      	tmp = 0
      	if (y + z) <= -2e-243:
      		tmp = x + (math.tan(y) - math.tan(a))
      	else:
      		tmp = x + (math.tan(z) - math.tan(a))
      	return tmp
      
      function code(x, y, z, a)
      	tmp = 0.0
      	if (Float64(y + z) <= -2e-243)
      		tmp = Float64(x + Float64(tan(y) - tan(a)));
      	else
      		tmp = Float64(x + Float64(tan(z) - tan(a)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, a)
      	tmp = 0.0;
      	if ((y + z) <= -2e-243)
      		tmp = x + (tan(y) - tan(a));
      	else
      		tmp = x + (tan(z) - tan(a));
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -2e-243], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y + z \leq -2 \cdot 10^{-243}:\\
      \;\;\;\;x + \left(\tan y - \tan a\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;x + \left(\tan z - \tan a\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 y z) < -1.99999999999999999e-243

        1. Initial program 73.8%

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

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{y}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
        4. Step-by-step derivation
          1. Simplified60.8%

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

          if -1.99999999999999999e-243 < (+.f64 y z)

          1. Initial program 79.2%

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

            \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{z}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
          4. Step-by-step derivation
            1. Simplified58.3%

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

          Alternative 10: 59.4% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y + z \leq 0.05:\\ \;\;\;\;x + \left(\tan y - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{1}{\tan \left(y + z\right)}}\\ \end{array} \end{array} \]
          (FPCore (x y z a)
           :precision binary64
           (if (<= (+ y z) 0.05)
             (+ x (- (tan y) (tan a)))
             (+ x (/ 1.0 (/ 1.0 (tan (+ y z)))))))
          double code(double x, double y, double z, double a) {
          	double tmp;
          	if ((y + z) <= 0.05) {
          		tmp = x + (tan(y) - tan(a));
          	} else {
          		tmp = x + (1.0 / (1.0 / tan((y + z))));
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z, a)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: a
              real(8) :: tmp
              if ((y + z) <= 0.05d0) then
                  tmp = x + (tan(y) - tan(a))
              else
                  tmp = x + (1.0d0 / (1.0d0 / tan((y + z))))
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double a) {
          	double tmp;
          	if ((y + z) <= 0.05) {
          		tmp = x + (Math.tan(y) - Math.tan(a));
          	} else {
          		tmp = x + (1.0 / (1.0 / Math.tan((y + z))));
          	}
          	return tmp;
          }
          
          def code(x, y, z, a):
          	tmp = 0
          	if (y + z) <= 0.05:
          		tmp = x + (math.tan(y) - math.tan(a))
          	else:
          		tmp = x + (1.0 / (1.0 / math.tan((y + z))))
          	return tmp
          
          function code(x, y, z, a)
          	tmp = 0.0
          	if (Float64(y + z) <= 0.05)
          		tmp = Float64(x + Float64(tan(y) - tan(a)));
          	else
          		tmp = Float64(x + Float64(1.0 / Float64(1.0 / tan(Float64(y + z)))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, a)
          	tmp = 0.0;
          	if ((y + z) <= 0.05)
          		tmp = x + (tan(y) - tan(a));
          	else
          		tmp = x + (1.0 / (1.0 / tan((y + z))));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], 0.05], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / N[(1.0 / N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y + z \leq 0.05:\\
          \;\;\;\;x + \left(\tan y - \tan a\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;x + \frac{1}{\frac{1}{\tan \left(y + z\right)}}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 y z) < 0.050000000000000003

            1. Initial program 77.8%

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

              \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\color{blue}{y}\right), \mathsf{tan.f64}\left(a\right)\right)\right) \]
            4. Step-by-step derivation
              1. Simplified66.5%

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

              if 0.050000000000000003 < (+.f64 y z)

              1. Initial program 73.7%

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

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

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

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
                4. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
                5. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
                6. cos-lowering-cos.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
                7. +-lowering-+.f6446.3%

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
              5. Simplified46.3%

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

                  \[\leadsto \mathsf{+.f64}\left(\left(\frac{1}{\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}}\right), x\right) \]
                2. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\cos \left(y + z\right)}{\sin \left(y + z\right)}\right)\right), x\right) \]
                3. clear-numN/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}}\right)\right), x\right) \]
                4. tan-quotN/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\tan \left(y + z\right)}\right)\right), x\right) \]
                5. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \tan \left(y + z\right)\right)\right), x\right) \]
                6. tan-lowering-tan.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\left(y + z\right)\right)\right)\right), x\right) \]
                7. +-lowering-+.f6446.3%

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right)\right), x\right) \]
              7. Applied egg-rr46.3%

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

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

            Alternative 11: 79.1% accurate, 1.0× speedup?

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

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

            Alternative 12: 60.0% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := x - \tan a\\ \mathbf{if}\;a \leq -1.35 \cdot 10^{-5}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.06:\\ \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z a)
             :precision binary64
             (let* ((t_0 (- x (tan a))))
               (if (<= a -1.35e-5) t_0 (if (<= a 0.06) (+ x (- (tan (+ y z)) a)) t_0))))
            double code(double x, double y, double z, double a) {
            	double t_0 = x - tan(a);
            	double tmp;
            	if (a <= -1.35e-5) {
            		tmp = t_0;
            	} else if (a <= 0.06) {
            		tmp = x + (tan((y + z)) - a);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z, a)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: a
                real(8) :: t_0
                real(8) :: tmp
                t_0 = x - tan(a)
                if (a <= (-1.35d-5)) then
                    tmp = t_0
                else if (a <= 0.06d0) then
                    tmp = x + (tan((y + z)) - a)
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double a) {
            	double t_0 = x - Math.tan(a);
            	double tmp;
            	if (a <= -1.35e-5) {
            		tmp = t_0;
            	} else if (a <= 0.06) {
            		tmp = x + (Math.tan((y + z)) - a);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z, a):
            	t_0 = x - math.tan(a)
            	tmp = 0
            	if a <= -1.35e-5:
            		tmp = t_0
            	elif a <= 0.06:
            		tmp = x + (math.tan((y + z)) - a)
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z, a)
            	t_0 = Float64(x - tan(a))
            	tmp = 0.0
            	if (a <= -1.35e-5)
            		tmp = t_0;
            	elseif (a <= 0.06)
            		tmp = Float64(x + Float64(tan(Float64(y + z)) - a));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, a)
            	t_0 = x - tan(a);
            	tmp = 0.0;
            	if (a <= -1.35e-5)
            		tmp = t_0;
            	elseif (a <= 0.06)
            		tmp = x + (tan((y + z)) - a);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, a_] := Block[{t$95$0 = N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.35e-5], t$95$0, If[LessEqual[a, 0.06], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := x - \tan a\\
            \mathbf{if}\;a \leq -1.35 \cdot 10^{-5}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;a \leq 0.06:\\
            \;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if a < -1.3499999999999999e-5 or 0.059999999999999998 < a

              1. Initial program 77.2%

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

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

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

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

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

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \cos y\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
                6. cos-lowering-cos.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
                7. --lowering--.f64N/A

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right)\right) \]
                9. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right)\right) \]
                10. cos-lowering-cos.f6460.9%

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right)\right) \]
              5. Simplified60.9%

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

                \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
              7. Step-by-step derivation
                1. --lowering--.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
                2. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right) \]
                3. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right) \]
                4. cos-lowering-cos.f6444.8%

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right) \]
              8. Simplified44.8%

                \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
              9. Step-by-step derivation
                1. --lowering--.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
                2. tan-quotN/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \tan a\right) \]
                3. tan-lowering-tan.f6444.8%

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{tan.f64}\left(a\right)\right) \]
              10. Applied egg-rr44.8%

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

              if -1.3499999999999999e-5 < a < 0.059999999999999998

              1. Initial program 75.5%

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

                \[\leadsto \mathsf{+.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{tan.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \color{blue}{a}\right)\right) \]
              4. Step-by-step derivation
                1. Simplified75.5%

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

              Alternative 13: 40.9% accurate, 2.0× speedup?

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \cos y\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
                6. cos-lowering-cos.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \left(x - \frac{\sin a}{\cos a}\right)\right) \]
                7. --lowering--.f64N/A

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right)\right) \]
                9. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right)\right) \]
                10. cos-lowering-cos.f6459.7%

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(y\right), \mathsf{cos.f64}\left(y\right)\right), \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right)\right) \]
              5. Simplified59.7%

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

                \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
              7. Step-by-step derivation
                1. --lowering--.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
                2. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\sin a, \color{blue}{\cos a}\right)\right) \]
                3. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \cos \color{blue}{a}\right)\right) \]
                4. cos-lowering-cos.f6440.9%

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(a\right), \mathsf{cos.f64}\left(a\right)\right)\right) \]
              8. Simplified40.9%

                \[\leadsto \color{blue}{x - \frac{\sin a}{\cos a}} \]
              9. Step-by-step derivation
                1. --lowering--.f64N/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \color{blue}{\left(\frac{\sin a}{\cos a}\right)}\right) \]
                2. tan-quotN/A

                  \[\leadsto \mathsf{\_.f64}\left(x, \tan a\right) \]
                3. tan-lowering-tan.f6440.9%

                  \[\leadsto \mathsf{\_.f64}\left(x, \mathsf{tan.f64}\left(a\right)\right) \]
              10. Applied egg-rr40.9%

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

              Alternative 14: 31.4% accurate, 2.0× speedup?

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

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

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

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

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

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\sin \left(y + z\right), \cos \left(y + z\right)\right), x\right) \]
                4. sin-lowering-sin.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(y + z\right)\right), \cos \left(y + z\right)\right), x\right) \]
                5. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \cos \left(y + z\right)\right), x\right) \]
                6. cos-lowering-cos.f64N/A

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\left(y + z\right)\right)\right), x\right) \]
                7. +-lowering-+.f6449.9%

                  \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(y, z\right)\right)\right), x\right) \]
              5. Simplified49.9%

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

                \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(y, z\right)\right), \mathsf{cos.f64}\left(\color{blue}{y}\right)\right), x\right) \]
              7. Step-by-step derivation
                1. Simplified41.2%

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

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

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

                    \[\leadsto \mathsf{+.f64}\left(\sin z, \color{blue}{x}\right) \]
                  3. sin-lowering-sin.f6430.2%

                    \[\leadsto \mathsf{+.f64}\left(\mathsf{sin.f64}\left(z\right), x\right) \]
                4. Simplified30.2%

                  \[\leadsto \color{blue}{\sin z + x} \]
                5. Final simplification30.2%

                  \[\leadsto x + \sin z \]
                6. Add Preprocessing

                Alternative 15: 31.2% accurate, 207.0× speedup?

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

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

                  \[\leadsto \color{blue}{x} \]
                4. Step-by-step derivation
                  1. Simplified30.0%

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

                  Reproduce

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