Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B

Percentage Accurate: 99.9% → 99.9%
Time: 12.2s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t):
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\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 13 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t):
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}

Alternative 1: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
	return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t)
	return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t)))
end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)} \]
    2. fma-define100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)} \]
    3. flip-+62.1%

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\frac{\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}}\right) \]
    4. associate-*r/55.6%

      \[\leadsto \mathsf{fma}\left(y, 5, \color{blue}{\frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}}\right) \]
    5. fma-neg59.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \color{blue}{\mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(\left(y + z\right) + z\right) + y, -t \cdot t\right)}}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    6. associate-+l+59.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(z + y\right)}, \left(\left(y + z\right) + z\right) + y, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    7. +-commutative59.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(y + z\right)}, \left(\left(y + z\right) + z\right) + y, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    8. count-259.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(\color{blue}{2 \cdot \left(y + z\right)}, \left(\left(y + z\right) + z\right) + y, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    9. associate-+l+59.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(2 \cdot \left(y + z\right), \color{blue}{\left(y + z\right) + \left(z + y\right)}, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    10. +-commutative59.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(2 \cdot \left(y + z\right), \left(y + z\right) + \color{blue}{\left(y + z\right)}, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    11. count-259.0%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \mathsf{fma}\left(2 \cdot \left(y + z\right), \color{blue}{2 \cdot \left(y + z\right)}, -t \cdot t\right)}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    12. fma-neg55.6%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \color{blue}{\left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}}{\left(\left(\left(y + z\right) + z\right) + y\right) - t}\right) \]
    13. associate-+l+55.6%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} - t}\right) \]
    14. +-commutative55.6%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) - t}\right) \]
    15. count-255.6%

      \[\leadsto \mathsf{fma}\left(y, 5, \frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{\color{blue}{2 \cdot \left(y + z\right)} - t}\right) \]
  4. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)} \]
  5. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right) \]
  6. Add Preprocessing

Alternative 2: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
	return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t)
	return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0))
end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. fma-define100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
    2. associate-+l+100.0%

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
    3. +-commutative100.0%

      \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
    4. count-2100.0%

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
  4. Add Preprocessing
  5. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right) \]
  6. Add Preprocessing

Alternative 3: 46.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.04 \cdot 10^{-23}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+122} \lor \neg \left(x \leq 1.18 \cdot 10^{+185}\right) \land x \leq 4.2 \cdot 10^{+252}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -1.04e-23)
   (* x t)
   (if (<= x 3.5e-75)
     (* y 5.0)
     (if (or (<= x 4.2e+122) (and (not (<= x 1.18e+185)) (<= x 4.2e+252)))
       (* x t)
       (* 2.0 (* x z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.04e-23) {
		tmp = x * t;
	} else if (x <= 3.5e-75) {
		tmp = y * 5.0;
	} else if ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252))) {
		tmp = x * t;
	} else {
		tmp = 2.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-1.04d-23)) then
        tmp = x * t
    else if (x <= 3.5d-75) then
        tmp = y * 5.0d0
    else if ((x <= 4.2d+122) .or. (.not. (x <= 1.18d+185)) .and. (x <= 4.2d+252)) then
        tmp = x * t
    else
        tmp = 2.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.04e-23) {
		tmp = x * t;
	} else if (x <= 3.5e-75) {
		tmp = y * 5.0;
	} else if ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252))) {
		tmp = x * t;
	} else {
		tmp = 2.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -1.04e-23:
		tmp = x * t
	elif x <= 3.5e-75:
		tmp = y * 5.0
	elif (x <= 4.2e+122) or (not (x <= 1.18e+185) and (x <= 4.2e+252)):
		tmp = x * t
	else:
		tmp = 2.0 * (x * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -1.04e-23)
		tmp = Float64(x * t);
	elseif (x <= 3.5e-75)
		tmp = Float64(y * 5.0);
	elseif ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252)))
		tmp = Float64(x * t);
	else
		tmp = Float64(2.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -1.04e-23)
		tmp = x * t;
	elseif (x <= 3.5e-75)
		tmp = y * 5.0;
	elseif ((x <= 4.2e+122) || (~((x <= 1.18e+185)) && (x <= 4.2e+252)))
		tmp = x * t;
	else
		tmp = 2.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.04e-23], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.5e-75], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 4.2e+122], And[N[Not[LessEqual[x, 1.18e+185]], $MachinePrecision], LessEqual[x, 4.2e+252]]], N[(x * t), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.04 \cdot 10^{-23}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 3.5 \cdot 10^{-75}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 4.2 \cdot 10^{+122} \lor \neg \left(x \leq 1.18 \cdot 10^{+185}\right) \land x \leq 4.2 \cdot 10^{+252}:\\
\;\;\;\;x \cdot t\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.04e-23 or 3.49999999999999985e-75 < x < 4.20000000000000032e122 or 1.18e185 < x < 4.2000000000000003e252

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+70.3%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/57.3%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg64.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-264.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative64.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+64.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-264.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative64.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+64.2%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg57.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-257.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative57.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+57.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in t around inf 44.7%

      \[\leadsto \color{blue}{t \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \color{blue}{x \cdot t} \]
    9. Simplified44.7%

      \[\leadsto \color{blue}{x \cdot t} \]

    if -1.04e-23 < x < 3.49999999999999985e-75

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 65.6%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified65.6%

      \[\leadsto \color{blue}{y \cdot 5} \]

    if 4.20000000000000032e122 < x < 1.18e185 or 4.2000000000000003e252 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+88.6%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/85.9%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-285.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-285.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-285.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+85.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr97.1%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in z around inf 48.6%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.04 \cdot 10^{-23}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-75}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+122} \lor \neg \left(x \leq 1.18 \cdot 10^{+185}\right) \land x \leq 4.2 \cdot 10^{+252}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 88.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot 5 + x \cdot t\\ t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -1.15:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-150}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-62}:\\ \;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-21}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (* y 5.0) (* x t))) (t_2 (* x (+ t (* (+ y z) 2.0)))))
   (if (<= x -1.15)
     t_2
     (if (<= x 3.8e-150)
       t_1
       (if (<= x 4e-62)
         (+ (* y 5.0) (* z (* x 2.0)))
         (if (<= x 1.65e-21) t_1 t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * 5.0) + (x * t);
	double t_2 = x * (t + ((y + z) * 2.0));
	double tmp;
	if (x <= -1.15) {
		tmp = t_2;
	} else if (x <= 3.8e-150) {
		tmp = t_1;
	} else if (x <= 4e-62) {
		tmp = (y * 5.0) + (z * (x * 2.0));
	} else if (x <= 1.65e-21) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (y * 5.0d0) + (x * t)
    t_2 = x * (t + ((y + z) * 2.0d0))
    if (x <= (-1.15d0)) then
        tmp = t_2
    else if (x <= 3.8d-150) then
        tmp = t_1
    else if (x <= 4d-62) then
        tmp = (y * 5.0d0) + (z * (x * 2.0d0))
    else if (x <= 1.65d-21) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * 5.0) + (x * t);
	double t_2 = x * (t + ((y + z) * 2.0));
	double tmp;
	if (x <= -1.15) {
		tmp = t_2;
	} else if (x <= 3.8e-150) {
		tmp = t_1;
	} else if (x <= 4e-62) {
		tmp = (y * 5.0) + (z * (x * 2.0));
	} else if (x <= 1.65e-21) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * 5.0) + (x * t)
	t_2 = x * (t + ((y + z) * 2.0))
	tmp = 0
	if x <= -1.15:
		tmp = t_2
	elif x <= 3.8e-150:
		tmp = t_1
	elif x <= 4e-62:
		tmp = (y * 5.0) + (z * (x * 2.0))
	elif x <= 1.65e-21:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y * 5.0) + Float64(x * t))
	t_2 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))
	tmp = 0.0
	if (x <= -1.15)
		tmp = t_2;
	elseif (x <= 3.8e-150)
		tmp = t_1;
	elseif (x <= 4e-62)
		tmp = Float64(Float64(y * 5.0) + Float64(z * Float64(x * 2.0)));
	elseif (x <= 1.65e-21)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y * 5.0) + (x * t);
	t_2 = x * (t + ((y + z) * 2.0));
	tmp = 0.0;
	if (x <= -1.15)
		tmp = t_2;
	elseif (x <= 3.8e-150)
		tmp = t_1;
	elseif (x <= 4e-62)
		tmp = (y * 5.0) + (z * (x * 2.0));
	elseif (x <= 1.65e-21)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15], t$95$2, If[LessEqual[x, 3.8e-150], t$95$1, If[LessEqual[x, 4e-62], N[(N[(y * 5.0), $MachinePrecision] + N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e-21], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -1.15:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 3.8 \cdot 10^{-150}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-62}:\\
\;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1499999999999999 or 1.65000000000000004e-21 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 98.5%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -1.1499999999999999 < x < 3.7999999999999998e-150 or 4.0000000000000002e-62 < x < 1.65000000000000004e-21

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 87.4%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Simplified87.4%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]

    if 3.7999999999999998e-150 < x < 4.0000000000000002e-62

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 94.4%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} + y \cdot 5 \]
    4. Simplified94.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-150}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-62}:\\ \;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-21}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 46.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-25}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{+122} \lor \neg \left(x \leq 5 \cdot 10^{+226}\right):\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -4.8e-25)
   (* x t)
   (if (<= x 6.6e-6)
     (* y 5.0)
     (if (or (<= x 1.06e+122) (not (<= x 5e+226)))
       (* x (* y 2.0))
       (* 2.0 (* x z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -4.8e-25) {
		tmp = x * t;
	} else if (x <= 6.6e-6) {
		tmp = y * 5.0;
	} else if ((x <= 1.06e+122) || !(x <= 5e+226)) {
		tmp = x * (y * 2.0);
	} else {
		tmp = 2.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-4.8d-25)) then
        tmp = x * t
    else if (x <= 6.6d-6) then
        tmp = y * 5.0d0
    else if ((x <= 1.06d+122) .or. (.not. (x <= 5d+226))) then
        tmp = x * (y * 2.0d0)
    else
        tmp = 2.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -4.8e-25) {
		tmp = x * t;
	} else if (x <= 6.6e-6) {
		tmp = y * 5.0;
	} else if ((x <= 1.06e+122) || !(x <= 5e+226)) {
		tmp = x * (y * 2.0);
	} else {
		tmp = 2.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -4.8e-25:
		tmp = x * t
	elif x <= 6.6e-6:
		tmp = y * 5.0
	elif (x <= 1.06e+122) or not (x <= 5e+226):
		tmp = x * (y * 2.0)
	else:
		tmp = 2.0 * (x * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -4.8e-25)
		tmp = Float64(x * t);
	elseif (x <= 6.6e-6)
		tmp = Float64(y * 5.0);
	elseif ((x <= 1.06e+122) || !(x <= 5e+226))
		tmp = Float64(x * Float64(y * 2.0));
	else
		tmp = Float64(2.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -4.8e-25)
		tmp = x * t;
	elseif (x <= 6.6e-6)
		tmp = y * 5.0;
	elseif ((x <= 1.06e+122) || ~((x <= 5e+226)))
		tmp = x * (y * 2.0);
	else
		tmp = 2.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e-25], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.6e-6], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.06e+122], N[Not[LessEqual[x, 5e+226]], $MachinePrecision]], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-25}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.06 \cdot 10^{+122} \lor \neg \left(x \leq 5 \cdot 10^{+226}\right):\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.80000000000000018e-25

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+76.3%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/57.9%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg66.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-266.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative66.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+66.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-266.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative66.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+66.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg57.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-257.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative57.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+57.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr91.2%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in t around inf 44.7%

      \[\leadsto \color{blue}{t \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \color{blue}{x \cdot t} \]
    9. Simplified44.7%

      \[\leadsto \color{blue}{x \cdot t} \]

    if -4.80000000000000018e-25 < x < 6.60000000000000034e-6

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 62.3%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified62.3%

      \[\leadsto \color{blue}{y \cdot 5} \]

    if 6.60000000000000034e-6 < x < 1.06000000000000002e122 or 5.0000000000000005e226 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 98.5%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in93.9%

        \[\leadsto \color{blue}{x \cdot t + x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
      2. *-commutative93.9%

        \[\leadsto x \cdot t + x \cdot \color{blue}{\left(\left(y + z\right) \cdot 2\right)} \]
      3. fma-define96.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, t, x \cdot \left(\left(y + z\right) \cdot 2\right)\right)} \]
    7. Applied egg-rr96.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, t, x \cdot \left(\left(y + z\right) \cdot 2\right)\right)} \]
    8. Taylor expanded in y around inf 50.7%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    9. Step-by-step derivation
      1. *-commutative50.7%

        \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot 2} \]
      2. associate-*l*50.7%

        \[\leadsto \color{blue}{x \cdot \left(y \cdot 2\right)} \]
      3. *-commutative50.7%

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y\right)} \]
    10. Simplified50.7%

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot y\right)} \]

    if 1.06000000000000002e122 < x < 5.0000000000000005e226

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+83.2%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/76.9%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg80.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-280.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative80.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+80.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-280.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative80.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+80.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg76.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-276.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative76.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+76.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr96.5%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in z around inf 47.2%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification53.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-25}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.06 \cdot 10^{+122} \lor \neg \left(x \leq 5 \cdot 10^{+226}\right):\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{+50}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-101}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-53}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* z 2.0)))))
   (if (<= z -2.4e+50)
     t_1
     (if (<= z 1.05e-101)
       (* x (+ t (* y 2.0)))
       (if (<= z 2.3e-53) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double tmp;
	if (z <= -2.4e+50) {
		tmp = t_1;
	} else if (z <= 1.05e-101) {
		tmp = x * (t + (y * 2.0));
	} else if (z <= 2.3e-53) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (t + (z * 2.0d0))
    if (z <= (-2.4d+50)) then
        tmp = t_1
    else if (z <= 1.05d-101) then
        tmp = x * (t + (y * 2.0d0))
    else if (z <= 2.3d-53) then
        tmp = y * 5.0d0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double tmp;
	if (z <= -2.4e+50) {
		tmp = t_1;
	} else if (z <= 1.05e-101) {
		tmp = x * (t + (y * 2.0));
	} else if (z <= 2.3e-53) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (z * 2.0))
	tmp = 0
	if z <= -2.4e+50:
		tmp = t_1
	elif z <= 1.05e-101:
		tmp = x * (t + (y * 2.0))
	elif z <= 2.3e-53:
		tmp = y * 5.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(z * 2.0)))
	tmp = 0.0
	if (z <= -2.4e+50)
		tmp = t_1;
	elseif (z <= 1.05e-101)
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	elseif (z <= 2.3e-53)
		tmp = Float64(y * 5.0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (z * 2.0));
	tmp = 0.0;
	if (z <= -2.4e+50)
		tmp = t_1;
	elseif (z <= 1.05e-101)
		tmp = x * (t + (y * 2.0));
	elseif (z <= 2.3e-53)
		tmp = y * 5.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+50], t$95$1, If[LessEqual[z, 1.05e-101], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e-53], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{-101}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\

\mathbf{elif}\;z \leq 2.3 \cdot 10^{-53}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.4000000000000002e50 or 2.3000000000000001e-53 < z

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+55.1%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/49.9%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg55.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-255.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative55.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+55.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-255.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative55.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+55.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg49.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-249.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative49.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+49.9%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr93.4%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in y around 0 69.8%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    8. Step-by-step derivation
      1. +-commutative69.8%

        \[\leadsto \color{blue}{t \cdot x + 2 \cdot \left(x \cdot z\right)} \]
      2. *-commutative69.8%

        \[\leadsto t \cdot x + 2 \cdot \color{blue}{\left(z \cdot x\right)} \]
      3. associate-*r*69.8%

        \[\leadsto t \cdot x + \color{blue}{\left(2 \cdot z\right) \cdot x} \]
      4. distribute-rgt-in75.5%

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right)} \]
    9. Simplified75.5%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right)} \]

    if -2.4000000000000002e50 < z < 1.05000000000000008e-101

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 69.0%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in z around 0 66.1%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]

    if 1.05000000000000008e-101 < z < 2.3000000000000001e-53

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 85.7%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified85.7%

      \[\leadsto \color{blue}{y \cdot 5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+50}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-101}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-53}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.55 \cdot 10^{+69}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+144}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -1.55e+69)
     t_1
     (if (<= y 5.8e-62)
       (* x (+ t (* z 2.0)))
       (if (<= y 4e+144) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.55e+69) {
		tmp = t_1;
	} else if (y <= 5.8e-62) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 4e+144) {
		tmp = (y * 5.0) + (x * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-1.55d+69)) then
        tmp = t_1
    else if (y <= 5.8d-62) then
        tmp = x * (t + (z * 2.0d0))
    else if (y <= 4d+144) then
        tmp = (y * 5.0d0) + (x * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.55e+69) {
		tmp = t_1;
	} else if (y <= 5.8e-62) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 4e+144) {
		tmp = (y * 5.0) + (x * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -1.55e+69:
		tmp = t_1
	elif y <= 5.8e-62:
		tmp = x * (t + (z * 2.0))
	elif y <= 4e+144:
		tmp = (y * 5.0) + (x * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -1.55e+69)
		tmp = t_1;
	elseif (y <= 5.8e-62)
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	elseif (y <= 4e+144)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -1.55e+69)
		tmp = t_1;
	elseif (y <= 5.8e-62)
		tmp = x * (t + (z * 2.0));
	elseif (y <= 4e+144)
		tmp = (y * 5.0) + (x * t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+69], t$95$1, If[LessEqual[y, 5.8e-62], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+144], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 5.8 \cdot 10^{-62}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\

\mathbf{elif}\;y \leq 4 \cdot 10^{+144}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.5499999999999999e69 or 4.00000000000000009e144 < y

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 89.5%

      \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
    4. Simplified89.5%

      \[\leadsto \color{blue}{y \cdot \left(5 + x \cdot 2\right)} \]

    if -1.5499999999999999e69 < y < 5.79999999999999971e-62

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+69.2%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/62.7%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg64.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-264.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative64.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+64.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-264.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative64.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+64.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg62.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-262.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative62.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+62.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in y around 0 81.1%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    8. Step-by-step derivation
      1. +-commutative81.1%

        \[\leadsto \color{blue}{t \cdot x + 2 \cdot \left(x \cdot z\right)} \]
      2. *-commutative81.1%

        \[\leadsto t \cdot x + 2 \cdot \color{blue}{\left(z \cdot x\right)} \]
      3. associate-*r*81.1%

        \[\leadsto t \cdot x + \color{blue}{\left(2 \cdot z\right) \cdot x} \]
      4. distribute-rgt-in82.9%

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right)} \]
    9. Simplified82.9%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right)} \]

    if 5.79999999999999971e-62 < y < 4.00000000000000009e144

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 74.8%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Simplified74.8%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.55 \cdot 10^{+69}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+144}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 88.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \lor \neg \left(x \leq 4.5 \cdot 10^{-21}\right):\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -1.15) (not (<= x 4.5e-21)))
   (* x (+ t (* (+ y z) 2.0)))
   (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.15) || !(x <= 4.5e-21)) {
		tmp = x * (t + ((y + z) * 2.0));
	} else {
		tmp = (y * 5.0) + (x * t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-1.15d0)) .or. (.not. (x <= 4.5d-21))) then
        tmp = x * (t + ((y + z) * 2.0d0))
    else
        tmp = (y * 5.0d0) + (x * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.15) || !(x <= 4.5e-21)) {
		tmp = x * (t + ((y + z) * 2.0));
	} else {
		tmp = (y * 5.0) + (x * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.15) or not (x <= 4.5e-21):
		tmp = x * (t + ((y + z) * 2.0))
	else:
		tmp = (y * 5.0) + (x * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.15) || !(x <= 4.5e-21))
		tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)));
	else
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -1.15) || ~((x <= 4.5e-21)))
		tmp = x * (t + ((y + z) * 2.0));
	else
		tmp = (y * 5.0) + (x * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.15], N[Not[LessEqual[x, 4.5e-21]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \lor \neg \left(x \leq 4.5 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1499999999999999 or 4.49999999999999968e-21 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 98.5%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -1.1499999999999999 < x < 4.49999999999999968e-21

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 84.1%

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Simplified84.1%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \lor \neg \left(x \leq 4.5 \cdot 10^{-21}\right):\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 63.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq 5 \cdot 10^{-67}\right):\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -5.5e-25) (not (<= x 5e-67))) (* x (+ t (* y 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -5.5e-25) || !(x <= 5e-67)) {
		tmp = x * (t + (y * 2.0));
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-5.5d-25)) .or. (.not. (x <= 5d-67))) then
        tmp = x * (t + (y * 2.0d0))
    else
        tmp = y * 5.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -5.5e-25) || !(x <= 5e-67)) {
		tmp = x * (t + (y * 2.0));
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -5.5e-25) or not (x <= 5e-67):
		tmp = x * (t + (y * 2.0))
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -5.5e-25) || !(x <= 5e-67))
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	else
		tmp = Float64(y * 5.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -5.5e-25) || ~((x <= 5e-67)))
		tmp = x * (t + (y * 2.0));
	else
		tmp = y * 5.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.5e-25], N[Not[LessEqual[x, 5e-67]], $MachinePrecision]], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq 5 \cdot 10^{-67}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.50000000000000004e-25 or 4.9999999999999999e-67 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 95.7%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]
    6. Taylor expanded in z around 0 70.8%

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]

    if -5.50000000000000004e-25 < x < 4.9999999999999999e-67

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 65.6%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified65.6%

      \[\leadsto \color{blue}{y \cdot 5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq 5 \cdot 10^{-67}\right):\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 78.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+68} \lor \neg \left(y \leq 7 \cdot 10^{+57}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -3.2e+68) (not (<= y 7e+57)))
   (* y (+ 5.0 (* x 2.0)))
   (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.2e+68) || !(y <= 7e+57)) {
		tmp = y * (5.0 + (x * 2.0));
	} else {
		tmp = x * (t + (z * 2.0));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y <= (-3.2d+68)) .or. (.not. (y <= 7d+57))) then
        tmp = y * (5.0d0 + (x * 2.0d0))
    else
        tmp = x * (t + (z * 2.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.2e+68) || !(y <= 7e+57)) {
		tmp = y * (5.0 + (x * 2.0));
	} else {
		tmp = x * (t + (z * 2.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -3.2e+68) or not (y <= 7e+57):
		tmp = y * (5.0 + (x * 2.0))
	else:
		tmp = x * (t + (z * 2.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -3.2e+68) || !(y <= 7e+57))
		tmp = Float64(y * Float64(5.0 + Float64(x * 2.0)));
	else
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -3.2e+68) || ~((y <= 7e+57)))
		tmp = y * (5.0 + (x * 2.0));
	else
		tmp = x * (t + (z * 2.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.2e+68], N[Not[LessEqual[y, 7e+57]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+68} \lor \neg \left(y \leq 7 \cdot 10^{+57}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.19999999999999994e68 or 6.9999999999999995e57 < y

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 83.3%

      \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
    4. Simplified83.3%

      \[\leadsto \color{blue}{y \cdot \left(5 + x \cdot 2\right)} \]

    if -3.19999999999999994e68 < y < 6.9999999999999995e57

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+70.9%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/63.7%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg65.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-265.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative65.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+65.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-265.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative65.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+65.3%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg63.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-263.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative63.7%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+63.7%

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

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in y around 0 76.4%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    8. Step-by-step derivation
      1. +-commutative76.4%

        \[\leadsto \color{blue}{t \cdot x + 2 \cdot \left(x \cdot z\right)} \]
      2. *-commutative76.4%

        \[\leadsto t \cdot x + 2 \cdot \color{blue}{\left(z \cdot x\right)} \]
      3. associate-*r*76.4%

        \[\leadsto t \cdot x + \color{blue}{\left(2 \cdot z\right) \cdot x} \]
      4. distribute-rgt-in77.8%

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right)} \]
    9. Simplified77.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+68} \lor \neg \left(y \leq 7 \cdot 10^{+57}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
	return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (y * 5.0d0) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
	return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t):
	return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t)
	return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))))
end
function tmp = code(x, y, z, t)
	tmp = (y * 5.0) + (x * (t + (y + (z + (y + z)))));
end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Add Preprocessing
  3. Final simplification100.0%

    \[\leadsto y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) \]
  4. Add Preprocessing

Alternative 12: 46.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-25} \lor \neg \left(x \leq 1.15 \cdot 10^{-64}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -6.8e-25) (not (<= x 1.15e-64))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -6.8e-25) || !(x <= 1.15e-64)) {
		tmp = x * t;
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-6.8d-25)) .or. (.not. (x <= 1.15d-64))) then
        tmp = x * t
    else
        tmp = y * 5.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -6.8e-25) || !(x <= 1.15e-64)) {
		tmp = x * t;
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -6.8e-25) or not (x <= 1.15e-64):
		tmp = x * t
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -6.8e-25) || !(x <= 1.15e-64))
		tmp = Float64(x * t);
	else
		tmp = Float64(y * 5.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -6.8e-25) || ~((x <= 1.15e-64)))
		tmp = x * t;
	else
		tmp = y * 5.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e-25], N[Not[LessEqual[x, 1.15e-64]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-25} \lor \neg \left(x \leq 1.15 \cdot 10^{-64}\right):\\
\;\;\;\;x \cdot t\\

\mathbf{else}:\\
\;\;\;\;y \cdot 5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.80000000000000003e-25 or 1.1500000000000001e-64 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-define100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
      2. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
      4. count-2100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
      3. flip-+74.3%

        \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
      4. associate-*r/63.6%

        \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
      5. fma-neg69.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      6. count-269.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      7. +-commutative69.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      8. associate-+l+69.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      9. count-269.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      10. +-commutative69.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      11. associate-+l+69.0%

        \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
      12. fma-neg63.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
      13. count-263.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
      14. +-commutative63.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
      15. associate-+l+63.6%

        \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
    6. Applied egg-rr94.1%

      \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
    7. Taylor expanded in t around inf 39.8%

      \[\leadsto \color{blue}{t \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative39.8%

        \[\leadsto \color{blue}{x \cdot t} \]
    9. Simplified39.8%

      \[\leadsto \color{blue}{x \cdot t} \]

    if -6.80000000000000003e-25 < x < 1.1500000000000001e-64

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 65.6%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified65.6%

      \[\leadsto \color{blue}{y \cdot 5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{-25} \lor \neg \left(x \leq 1.15 \cdot 10^{-64}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 31.2% accurate, 5.0× speedup?

\[\begin{array}{l} \\ x \cdot t \end{array} \]
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
	return x * t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x * t
end function
public static double code(double x, double y, double z, double t) {
	return x * t;
}
def code(x, y, z, t):
	return x * t
function code(x, y, z, t)
	return Float64(x * t)
end
function tmp = code(x, y, z, t)
	tmp = x * t;
end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}

\\
x \cdot t
\end{array}
Derivation
  1. Initial program 100.0%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. fma-define100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(\left(\left(y + z\right) + z\right) + y\right) + t, y \cdot 5\right)} \]
    2. associate-+l+100.0%

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
    3. +-commutative100.0%

      \[\leadsto \mathsf{fma}\left(x, \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t, y \cdot 5\right) \]
    4. count-2100.0%

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine100.0%

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right) + t\right) + y \cdot 5} \]
    2. +-commutative100.0%

      \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)} \]
    3. flip-+62.1%

      \[\leadsto y \cdot 5 + x \cdot \color{blue}{\frac{\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t}{2 \cdot \left(y + z\right) - t}} \]
    4. associate-*r/55.6%

      \[\leadsto y \cdot 5 + \color{blue}{\frac{x \cdot \left(\left(2 \cdot \left(y + z\right)\right) \cdot \left(2 \cdot \left(y + z\right)\right) - t \cdot t\right)}{2 \cdot \left(y + z\right) - t}} \]
    5. fma-neg59.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\mathsf{fma}\left(2 \cdot \left(y + z\right), 2 \cdot \left(y + z\right), -t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
    6. count-259.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(y + z\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    7. +-commutative59.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    8. associate-+l+59.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\color{blue}{\left(\left(y + z\right) + z\right) + y}, 2 \cdot \left(y + z\right), -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    9. count-259.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(y + z\right) + \left(y + z\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    10. +-commutative59.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \left(y + z\right) + \color{blue}{\left(z + y\right)}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    11. associate-+l+59.0%

      \[\leadsto y \cdot 5 + \frac{x \cdot \mathsf{fma}\left(\left(\left(y + z\right) + z\right) + y, \color{blue}{\left(\left(y + z\right) + z\right) + y}, -t \cdot t\right)}{2 \cdot \left(y + z\right) - t} \]
    12. fma-neg55.6%

      \[\leadsto y \cdot 5 + \frac{x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}}{2 \cdot \left(y + z\right) - t} \]
    13. count-255.6%

      \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(y + z\right) + \left(y + z\right)\right)} - t} \]
    14. +-commutative55.6%

      \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\left(\left(y + z\right) + \color{blue}{\left(z + y\right)}\right) - t} \]
    15. associate-+l+55.6%

      \[\leadsto y \cdot 5 + \frac{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) \cdot \left(\left(\left(y + z\right) + z\right) + y\right) - t \cdot t\right)}{\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} - t} \]
  6. Applied egg-rr96.4%

    \[\leadsto \color{blue}{\left(y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\right) + x \cdot t} \]
  7. Taylor expanded in t around inf 32.3%

    \[\leadsto \color{blue}{t \cdot x} \]
  8. Step-by-step derivation
    1. *-commutative32.3%

      \[\leadsto \color{blue}{x \cdot t} \]
  9. Simplified32.3%

    \[\leadsto \color{blue}{x \cdot t} \]
  10. Final simplification32.3%

    \[\leadsto x \cdot t \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024052 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))