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

Percentage Accurate: 99.9% → 99.9%
Time: 8.1s
Alternatives: 15
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 15 alternatives:

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

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

\\
\mathsf{fma}\left(5, y, x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\right)
\end{array}
Derivation
  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-define99.9%

      \[\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+99.9%

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

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

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

    \[\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 t around 0 97.2%

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-12} \lor \neg \left(x \leq 2.3 \cdot 10^{-103}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2e-12 or 2.3000000000000001e-103 < x

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 99.9%

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

    if -7.2e-12 < x < 2.3000000000000001e-103

    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 y around 0 99.9%

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

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

Alternative 3: 64.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+92}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-211} \lor \neg \left(x \leq 1.6 \cdot 10^{-156}\right):\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -2.1e+92)
   (* x (+ t (* y 2.0)))
   (if (or (<= x -1.4e-211) (not (<= x 1.6e-156)))
     (* x (+ t (* 2.0 z)))
     (* 5.0 y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -2.1e+92) {
		tmp = x * (t + (y * 2.0));
	} else if ((x <= -1.4e-211) || !(x <= 1.6e-156)) {
		tmp = x * (t + (2.0 * z));
	} else {
		tmp = 5.0 * y;
	}
	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 <= (-2.1d+92)) then
        tmp = x * (t + (y * 2.0d0))
    else if ((x <= (-1.4d-211)) .or. (.not. (x <= 1.6d-156))) then
        tmp = x * (t + (2.0d0 * z))
    else
        tmp = 5.0d0 * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -2.1e+92) {
		tmp = x * (t + (y * 2.0));
	} else if ((x <= -1.4e-211) || !(x <= 1.6e-156)) {
		tmp = x * (t + (2.0 * z));
	} else {
		tmp = 5.0 * y;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -2.1e+92:
		tmp = x * (t + (y * 2.0))
	elif (x <= -1.4e-211) or not (x <= 1.6e-156):
		tmp = x * (t + (2.0 * z))
	else:
		tmp = 5.0 * y
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -2.1e+92)
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	elseif ((x <= -1.4e-211) || !(x <= 1.6e-156))
		tmp = Float64(x * Float64(t + Float64(2.0 * z)));
	else
		tmp = Float64(5.0 * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -2.1e+92)
		tmp = x * (t + (y * 2.0));
	elseif ((x <= -1.4e-211) || ~((x <= 1.6e-156)))
		tmp = x * (t + (2.0 * z));
	else
		tmp = 5.0 * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e+92], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.4e-211], N[Not[LessEqual[x, 1.6e-156]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+92}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\

\mathbf{elif}\;x \leq -1.4 \cdot 10^{-211} \lor \neg \left(x \leq 1.6 \cdot 10^{-156}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.09999999999999986e92

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 99.9%

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

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

    if -2.09999999999999986e92 < x < -1.3999999999999999e-211 or 1.59999999999999991e-156 < x

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 81.4%

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

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

    if -1.3999999999999999e-211 < x < 1.59999999999999991e-156

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 y around inf 66.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+92}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-211} \lor \neg \left(x \leq 1.6 \cdot 10^{-156}\right):\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.5 or 1.0499999999999999e-6 < x

    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. Taylor expanded in x around inf 98.9%

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

    if -2.5 < x < 1.0499999999999999e-6

    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 y around 0 98.7%

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

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

Alternative 5: 84.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -390000000000:\\ \;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -390000000000.0)
   (+ (* 5.0 y) (* 2.0 (* x z)))
   (if (<= z 8.5e+127)
     (+ (* y (+ 5.0 (* x 2.0))) (* x t))
     (* x (+ t (* 2.0 (+ y z)))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -390000000000.0) {
		tmp = (5.0 * y) + (2.0 * (x * z));
	} else if (z <= 8.5e+127) {
		tmp = (y * (5.0 + (x * 2.0))) + (x * t);
	} else {
		tmp = x * (t + (2.0 * (y + 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 (z <= (-390000000000.0d0)) then
        tmp = (5.0d0 * y) + (2.0d0 * (x * z))
    else if (z <= 8.5d+127) then
        tmp = (y * (5.0d0 + (x * 2.0d0))) + (x * t)
    else
        tmp = x * (t + (2.0d0 * (y + z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -390000000000.0) {
		tmp = (5.0 * y) + (2.0 * (x * z));
	} else if (z <= 8.5e+127) {
		tmp = (y * (5.0 + (x * 2.0))) + (x * t);
	} else {
		tmp = x * (t + (2.0 * (y + z)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -390000000000.0:
		tmp = (5.0 * y) + (2.0 * (x * z))
	elif z <= 8.5e+127:
		tmp = (y * (5.0 + (x * 2.0))) + (x * t)
	else:
		tmp = x * (t + (2.0 * (y + z)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -390000000000.0)
		tmp = Float64(Float64(5.0 * y) + Float64(2.0 * Float64(x * z)));
	elseif (z <= 8.5e+127)
		tmp = Float64(Float64(y * Float64(5.0 + Float64(x * 2.0))) + Float64(x * t));
	else
		tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -390000000000.0)
		tmp = (5.0 * y) + (2.0 * (x * z));
	elseif (z <= 8.5e+127)
		tmp = (y * (5.0 + (x * 2.0))) + (x * t);
	else
		tmp = x * (t + (2.0 * (y + z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -390000000000.0], N[(N[(5.0 * y), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+127], N[(N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000000000:\\
\;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{+127}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.9e11

    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 84.3%

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

    if -3.9e11 < z < 8.4999999999999997e127

    1. Initial program 99.8%

      \[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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 y around 0 99.9%

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

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

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

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

    if 8.4999999999999997e127 < 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. Taylor expanded in x around inf 89.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -390000000000:\\ \;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 45.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.8 \cdot 10^{+24}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -1.95 \cdot 10^{-86}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{+96}:\\ \;\;\;\;x \cdot \left(2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -3.8e+24)
   (* x t)
   (if (<= t -1.95e-86)
     (* 5.0 y)
     (if (<= t 1.85e+96) (* x (* 2.0 z)) (* x t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.8e+24) {
		tmp = x * t;
	} else if (t <= -1.95e-86) {
		tmp = 5.0 * y;
	} else if (t <= 1.85e+96) {
		tmp = x * (2.0 * z);
	} else {
		tmp = 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 (t <= (-3.8d+24)) then
        tmp = x * t
    else if (t <= (-1.95d-86)) then
        tmp = 5.0d0 * y
    else if (t <= 1.85d+96) then
        tmp = x * (2.0d0 * z)
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.8e+24) {
		tmp = x * t;
	} else if (t <= -1.95e-86) {
		tmp = 5.0 * y;
	} else if (t <= 1.85e+96) {
		tmp = x * (2.0 * z);
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -3.8e+24:
		tmp = x * t
	elif t <= -1.95e-86:
		tmp = 5.0 * y
	elif t <= 1.85e+96:
		tmp = x * (2.0 * z)
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -3.8e+24)
		tmp = Float64(x * t);
	elseif (t <= -1.95e-86)
		tmp = Float64(5.0 * y);
	elseif (t <= 1.85e+96)
		tmp = Float64(x * Float64(2.0 * z));
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -3.8e+24)
		tmp = x * t;
	elseif (t <= -1.95e-86)
		tmp = 5.0 * y;
	elseif (t <= 1.85e+96)
		tmp = x * (2.0 * z);
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.8e+24], N[(x * t), $MachinePrecision], If[LessEqual[t, -1.95e-86], N[(5.0 * y), $MachinePrecision], If[LessEqual[t, 1.85e+96], N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+24}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;t \leq -1.95 \cdot 10^{-86}:\\
\;\;\;\;5 \cdot y\\

\mathbf{elif}\;t \leq 1.85 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.80000000000000015e24 or 1.84999999999999996e96 < t

    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. Taylor expanded in t around 0 94.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    13. Simplified58.3%

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

    if -3.80000000000000015e24 < t < -1.9500000000000001e-86

    1. Initial program 99.6%

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

        \[\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+99.6%

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

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

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

      \[\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 y around inf 71.6%

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

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

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

    if -1.9500000000000001e-86 < t < 1.84999999999999996e96

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 t around 0 99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    9. Step-by-step derivation
      1. associate-*r*52.0%

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutative52.0%

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

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    10. Simplified52.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.8 \cdot 10^{+24}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -1.95 \cdot 10^{-86}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{+96}:\\ \;\;\;\;x \cdot \left(2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+41}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(5 \cdot y + x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x 1e+41)
   (+ (* 2.0 (* x (+ y z))) (+ (* 5.0 y) (* x t)))
   (* x (+ t (* 2.0 (+ y z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 1e+41) {
		tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t));
	} else {
		tmp = x * (t + (2.0 * (y + 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 <= 1d+41) then
        tmp = (2.0d0 * (x * (y + z))) + ((5.0d0 * y) + (x * t))
    else
        tmp = x * (t + (2.0d0 * (y + z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 1e+41) {
		tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t));
	} else {
		tmp = x * (t + (2.0 * (y + z)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= 1e+41:
		tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t))
	else:
		tmp = x * (t + (2.0 * (y + z)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= 1e+41)
		tmp = Float64(Float64(2.0 * Float64(x * Float64(y + z))) + Float64(Float64(5.0 * y) + Float64(x * t)));
	else
		tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= 1e+41)
		tmp = (2.0 * (x * (y + z))) + ((5.0 * y) + (x * t));
	else
		tmp = x * (t + (2.0 * (y + z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, 1e+41], N[(N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(5.0 * y), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+41}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(5 \cdot y + x \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.00000000000000001e41

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 t around 0 98.9%

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

    if 1.00000000000000001e41 < 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 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 10^{+41}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(5 \cdot y + x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\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.02 \cdot 10^{-18} \lor \neg \left(x \leq 1.7 \cdot 10^{-85}\right):\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;5 \cdot y + 2 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -1.02e-18) (not (<= x 1.7e-85)))
   (* x (+ t (* 2.0 (+ y z))))
   (+ (* 5.0 y) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.02e-18) || !(x <= 1.7e-85)) {
		tmp = x * (t + (2.0 * (y + z)));
	} else {
		tmp = (5.0 * y) + (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.02d-18)) .or. (.not. (x <= 1.7d-85))) then
        tmp = x * (t + (2.0d0 * (y + z)))
    else
        tmp = (5.0d0 * y) + (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.02e-18) || !(x <= 1.7e-85)) {
		tmp = x * (t + (2.0 * (y + z)));
	} else {
		tmp = (5.0 * y) + (2.0 * (x * z));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.02e-18) or not (x <= 1.7e-85):
		tmp = x * (t + (2.0 * (y + z)))
	else:
		tmp = (5.0 * y) + (2.0 * (x * z))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.02e-18) || !(x <= 1.7e-85))
		tmp = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))));
	else
		tmp = Float64(Float64(5.0 * y) + Float64(2.0 * Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -1.02e-18) || ~((x <= 1.7e-85)))
		tmp = x * (t + (2.0 * (y + z)));
	else
		tmp = (5.0 * y) + (2.0 * (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.02e-18], N[Not[LessEqual[x, 1.7e-85]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * y), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-18} \lor \neg \left(x \leq 1.7 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.02e-18 or 1.7e-85 < x

    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-define99.9%

        \[\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+99.9%

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

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

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

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

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

    if -1.02e-18 < x < 1.7e-85

    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 z around inf 80.8%

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

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

Alternative 9: 87.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.49999999999999994e-18 or 2.90000000000000011e-146 < x

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 92.5%

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

    if -4.49999999999999994e-18 < x < 2.90000000000000011e-146

    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 80.5%

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

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

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

Alternative 10: 77.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.16 \cdot 10^{+114} \lor \neg \left(y \leq 4.2 \cdot 10^{+32}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.16000000000000009e114 or 4.2000000000000001e32 < y

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 y around inf 80.5%

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

    if -2.16000000000000009e114 < y < 4.2000000000000001e32

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 83.7%

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

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

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

Alternative 11: 58.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -390000000000 \lor \neg \left(z \leq 1.9 \cdot 10^{+126}\right):\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.9e11 or 1.90000000000000008e126 < 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. Taylor expanded in t around 0 93.9%

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

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

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    9. Step-by-step derivation
      1. associate-*r*66.8%

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

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

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    10. Simplified66.8%

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

    if -3.9e11 < z < 1.90000000000000008e126

    1. Initial program 99.8%

      \[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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 67.2%

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

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

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

Alternative 12: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + 5 \cdot y \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ t (+ y (+ z (+ y z))))) (* 5.0 y)))
double code(double x, double y, double z, double t) {
	return (x * (t + (y + (z + (y + z))))) + (5.0 * y);
}
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 + (y + (z + (y + z))))) + (5.0d0 * y)
end function
public static double code(double x, double y, double z, double t) {
	return (x * (t + (y + (z + (y + z))))) + (5.0 * y);
}
def code(x, y, z, t):
	return (x * (t + (y + (z + (y + z))))) + (5.0 * y)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(5.0 * y))
end
function tmp = code(x, y, z, t)
	tmp = (x * (t + (y + (z + (y + z))))) + (5.0 * y);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + 5 \cdot y
\end{array}
Derivation
  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. Final simplification99.9%

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

Alternative 13: 96.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + x \cdot 2\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (* x (+ t (* 2.0 z))) (* y (+ 5.0 (* x 2.0)))))
double code(double x, double y, double z, double t) {
	return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.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 * (t + (2.0d0 * z))) + (y * (5.0d0 + (x * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
	return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
}
def code(x, y, z, t):
	return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)))
function code(x, y, z, t)
	return Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * Float64(5.0 + Float64(x * 2.0))))
end
function tmp = code(x, y, z, t)
	tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + x \cdot 2\right)
\end{array}
Derivation
  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-define99.9%

      \[\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+99.9%

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

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

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

    \[\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 y around 0 97.6%

    \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + 2 \cdot x\right)} \]
  6. Final simplification97.6%

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

Alternative 14: 44.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+25} \lor \neg \left(t \leq 1.8 \cdot 10^{+104}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.49999999999999993e25 or 1.8e104 < t

    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. Taylor expanded in t around 0 94.0%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(5 \cdot y + t \cdot x\right)} \]
    6. Step-by-step derivation
      1. *-commutative94.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    13. Simplified58.7%

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

    if -7.49999999999999993e25 < t < 1.8e104

    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-define99.9%

        \[\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+99.9%

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

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

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

      \[\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 y around inf 53.8%

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

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

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

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

Alternative 15: 30.3% 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 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-define99.9%

      \[\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+99.9%

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

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

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

    \[\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 t around 0 97.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot t} \]
  13. Simplified29.4%

    \[\leadsto \color{blue}{x \cdot t} \]
  14. Add Preprocessing

Reproduce

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