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

Percentage Accurate: 99.9% → 99.9%
Time: 11.3s
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-def100.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-+58.9%

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

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

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

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

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

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

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

      \[\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-neg56.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+56.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. +-commutative56.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-256.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-def100.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.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x \cdot 2\right)\\ t_2 := x \cdot \left(y \cdot 2\right)\\ \mathbf{if}\;x \leq -4.5 \cdot 10^{+183}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{+106}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{+20}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-80}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-29}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 500:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+80}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (* x 2.0))) (t_2 (* x (* y 2.0))))
   (if (<= x -4.5e+183)
     t_1
     (if (<= x -5.6e+106)
       t_2
       (if (<= x -5.7e+20)
         (* x t)
         (if (<= x -9e-80)
           t_1
           (if (<= x 2.7e-29)
             (* y 5.0)
             (if (<= x 500.0) (* x t) (if (<= x 4.1e+80) t_2 t_1)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x * 2.0);
	double t_2 = x * (y * 2.0);
	double tmp;
	if (x <= -4.5e+183) {
		tmp = t_1;
	} else if (x <= -5.6e+106) {
		tmp = t_2;
	} else if (x <= -5.7e+20) {
		tmp = x * t;
	} else if (x <= -9e-80) {
		tmp = t_1;
	} else if (x <= 2.7e-29) {
		tmp = y * 5.0;
	} else if (x <= 500.0) {
		tmp = x * t;
	} else if (x <= 4.1e+80) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = z * (x * 2.0d0)
    t_2 = x * (y * 2.0d0)
    if (x <= (-4.5d+183)) then
        tmp = t_1
    else if (x <= (-5.6d+106)) then
        tmp = t_2
    else if (x <= (-5.7d+20)) then
        tmp = x * t
    else if (x <= (-9d-80)) then
        tmp = t_1
    else if (x <= 2.7d-29) then
        tmp = y * 5.0d0
    else if (x <= 500.0d0) then
        tmp = x * t
    else if (x <= 4.1d+80) then
        tmp = t_2
    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 = z * (x * 2.0);
	double t_2 = x * (y * 2.0);
	double tmp;
	if (x <= -4.5e+183) {
		tmp = t_1;
	} else if (x <= -5.6e+106) {
		tmp = t_2;
	} else if (x <= -5.7e+20) {
		tmp = x * t;
	} else if (x <= -9e-80) {
		tmp = t_1;
	} else if (x <= 2.7e-29) {
		tmp = y * 5.0;
	} else if (x <= 500.0) {
		tmp = x * t;
	} else if (x <= 4.1e+80) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x * 2.0)
	t_2 = x * (y * 2.0)
	tmp = 0
	if x <= -4.5e+183:
		tmp = t_1
	elif x <= -5.6e+106:
		tmp = t_2
	elif x <= -5.7e+20:
		tmp = x * t
	elif x <= -9e-80:
		tmp = t_1
	elif x <= 2.7e-29:
		tmp = y * 5.0
	elif x <= 500.0:
		tmp = x * t
	elif x <= 4.1e+80:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x * 2.0))
	t_2 = Float64(x * Float64(y * 2.0))
	tmp = 0.0
	if (x <= -4.5e+183)
		tmp = t_1;
	elseif (x <= -5.6e+106)
		tmp = t_2;
	elseif (x <= -5.7e+20)
		tmp = Float64(x * t);
	elseif (x <= -9e-80)
		tmp = t_1;
	elseif (x <= 2.7e-29)
		tmp = Float64(y * 5.0);
	elseif (x <= 500.0)
		tmp = Float64(x * t);
	elseif (x <= 4.1e+80)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (x * 2.0);
	t_2 = x * (y * 2.0);
	tmp = 0.0;
	if (x <= -4.5e+183)
		tmp = t_1;
	elseif (x <= -5.6e+106)
		tmp = t_2;
	elseif (x <= -5.7e+20)
		tmp = x * t;
	elseif (x <= -9e-80)
		tmp = t_1;
	elseif (x <= 2.7e-29)
		tmp = y * 5.0;
	elseif (x <= 500.0)
		tmp = x * t;
	elseif (x <= 4.1e+80)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e+183], t$95$1, If[LessEqual[x, -5.6e+106], t$95$2, If[LessEqual[x, -5.7e+20], N[(x * t), $MachinePrecision], If[LessEqual[x, -9e-80], t$95$1, If[LessEqual[x, 2.7e-29], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 500.0], N[(x * t), $MachinePrecision], If[LessEqual[x, 4.1e+80], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -5.6 \cdot 10^{+106}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -5.7 \cdot 10^{+20}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -9 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{-29}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 500:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 4.1 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.50000000000000017e183 or -5.7e20 < x < -9.0000000000000006e-80 or 4.10000000000000001e80 < 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-def100.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 96.4%

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

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

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

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

    if -4.50000000000000017e183 < x < -5.59999999999999986e106 or 500 < x < 4.10000000000000001e80

    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-def100.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 93.2%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot y\right)} \]
    8. Simplified52.1%

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

    if -5.59999999999999986e106 < x < -5.7e20 or 2.70000000000000023e-29 < x < 500

    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-def99.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.7%

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified62.3%

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

    if -9.0000000000000006e-80 < x < 2.70000000000000023e-29

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified60.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+183}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{+20}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-80}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-29}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 500:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+80}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 45.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(y \cdot 2\right)\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{+143}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+106}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-87}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-40}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 500 \lor \neg \left(x \leq 3.5 \cdot 10^{+101}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (* y 2.0))))
   (if (<= x -3.2e+143)
     (* x t)
     (if (<= x -5e+106)
       t_1
       (if (<= x -3.8e-87)
         (* x t)
         (if (<= x 1.4e-40)
           (* y 5.0)
           (if (or (<= x 500.0) (not (<= x 3.5e+101))) (* x t) t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (y * 2.0);
	double tmp;
	if (x <= -3.2e+143) {
		tmp = x * t;
	} else if (x <= -5e+106) {
		tmp = t_1;
	} else if (x <= -3.8e-87) {
		tmp = x * t;
	} else if (x <= 1.4e-40) {
		tmp = y * 5.0;
	} else if ((x <= 500.0) || !(x <= 3.5e+101)) {
		tmp = 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 = x * (y * 2.0d0)
    if (x <= (-3.2d+143)) then
        tmp = x * t
    else if (x <= (-5d+106)) then
        tmp = t_1
    else if (x <= (-3.8d-87)) then
        tmp = x * t
    else if (x <= 1.4d-40) then
        tmp = y * 5.0d0
    else if ((x <= 500.0d0) .or. (.not. (x <= 3.5d+101))) then
        tmp = 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 = x * (y * 2.0);
	double tmp;
	if (x <= -3.2e+143) {
		tmp = x * t;
	} else if (x <= -5e+106) {
		tmp = t_1;
	} else if (x <= -3.8e-87) {
		tmp = x * t;
	} else if (x <= 1.4e-40) {
		tmp = y * 5.0;
	} else if ((x <= 500.0) || !(x <= 3.5e+101)) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (y * 2.0)
	tmp = 0
	if x <= -3.2e+143:
		tmp = x * t
	elif x <= -5e+106:
		tmp = t_1
	elif x <= -3.8e-87:
		tmp = x * t
	elif x <= 1.4e-40:
		tmp = y * 5.0
	elif (x <= 500.0) or not (x <= 3.5e+101):
		tmp = x * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(y * 2.0))
	tmp = 0.0
	if (x <= -3.2e+143)
		tmp = Float64(x * t);
	elseif (x <= -5e+106)
		tmp = t_1;
	elseif (x <= -3.8e-87)
		tmp = Float64(x * t);
	elseif (x <= 1.4e-40)
		tmp = Float64(y * 5.0);
	elseif ((x <= 500.0) || !(x <= 3.5e+101))
		tmp = Float64(x * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (y * 2.0);
	tmp = 0.0;
	if (x <= -3.2e+143)
		tmp = x * t;
	elseif (x <= -5e+106)
		tmp = t_1;
	elseif (x <= -3.8e-87)
		tmp = x * t;
	elseif (x <= 1.4e-40)
		tmp = y * 5.0;
	elseif ((x <= 500.0) || ~((x <= 3.5e+101)))
		tmp = x * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e+143], N[(x * t), $MachinePrecision], If[LessEqual[x, -5e+106], t$95$1, If[LessEqual[x, -3.8e-87], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.4e-40], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 500.0], N[Not[LessEqual[x, 3.5e+101]], $MachinePrecision]], N[(x * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -5 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-40}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 500 \lor \neg \left(x \leq 3.5 \cdot 10^{+101}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.20000000000000016e143 or -4.9999999999999998e106 < x < -3.8e-87 or 1.4e-40 < x < 500 or 3.50000000000000023e101 < 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-def100.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.1%

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified44.4%

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

    if -3.20000000000000016e143 < x < -4.9999999999999998e106 or 500 < x < 3.50000000000000023e101

    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-def100.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 91.1%

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

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

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

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

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

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

    if -3.8e-87 < x < 1.4e-40

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified61.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{+143}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-87}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-40}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 500 \lor \neg \left(x \leq 3.5 \cdot 10^{+101}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-185} \lor \neg \left(x \leq 7.2 \cdot 10^{-238}\right) \land \left(x \leq 1.38 \cdot 10^{-188} \lor \neg \left(x \leq 1.35 \cdot 10^{-41}\right)\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.00000000000000061e-185 or 7.20000000000000021e-238 < x < 1.3800000000000001e-188 or 1.35e-41 < 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-def100.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 88.5%

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

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

    if -6.00000000000000061e-185 < x < 7.20000000000000021e-238 or 1.3800000000000001e-188 < x < 1.35e-41

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified69.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{-185} \lor \neg \left(x \leq 7.2 \cdot 10^{-238}\right) \land \left(x \leq 1.38 \cdot 10^{-188} \lor \neg \left(x \leq 1.35 \cdot 10^{-41}\right)\right):\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 88.5% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq 1.2 \cdot 10^{-298}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.5000000000000007e-74 or 9.0000000000000002e-35 < 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-def100.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.0%

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

    if -9.5000000000000007e-74 < x < 1.19999999999999994e-298

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

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

    if 1.19999999999999994e-298 < x < 9.0000000000000002e-35

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{-74}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-298}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-35}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 61.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-74}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* y 2.0)))))
   (if (<= x -8.6e+20)
     t_1
     (if (<= x -2.3e-74) (* z (* x 2.0)) (if (<= x 5.2e-36) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -8.6e+20) {
		tmp = t_1;
	} else if (x <= -2.3e-74) {
		tmp = z * (x * 2.0);
	} else if (x <= 5.2e-36) {
		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 + (y * 2.0d0))
    if (x <= (-8.6d+20)) then
        tmp = t_1
    else if (x <= (-2.3d-74)) then
        tmp = z * (x * 2.0d0)
    else if (x <= 5.2d-36) 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 + (y * 2.0));
	double tmp;
	if (x <= -8.6e+20) {
		tmp = t_1;
	} else if (x <= -2.3e-74) {
		tmp = z * (x * 2.0);
	} else if (x <= 5.2e-36) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (y * 2.0))
	tmp = 0
	if x <= -8.6e+20:
		tmp = t_1
	elif x <= -2.3e-74:
		tmp = z * (x * 2.0)
	elif x <= 5.2e-36:
		tmp = y * 5.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(y * 2.0)))
	tmp = 0.0
	if (x <= -8.6e+20)
		tmp = t_1;
	elseif (x <= -2.3e-74)
		tmp = Float64(z * Float64(x * 2.0));
	elseif (x <= 5.2e-36)
		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 + (y * 2.0));
	tmp = 0.0;
	if (x <= -8.6e+20)
		tmp = t_1;
	elseif (x <= -2.3e-74)
		tmp = z * (x * 2.0);
	elseif (x <= 5.2e-36)
		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[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e+20], t$95$1, If[LessEqual[x, -2.3e-74], N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e-36], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -2.3 \cdot 10^{-74}:\\
\;\;\;\;z \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;x \leq 5.2 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.6e20 or 5.2000000000000001e-36 < 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-def100.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 96.8%

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

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

    if -8.6e20 < x < -2.2999999999999998e-74

    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-def100.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 81.5%

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

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

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

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

    if -2.2999999999999998e-74 < x < 5.2000000000000001e-36

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified60.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+20}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-74}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.0% 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.4 \cdot 10^{+111}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+94}:\\ \;\;\;\;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.4e+111)
     t_1
     (if (<= y 1.05e-63)
       (* x (+ t (* z 2.0)))
       (if (<= y 2.9e+94) (+ (* 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.4e+111) {
		tmp = t_1;
	} else if (y <= 1.05e-63) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 2.9e+94) {
		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.4d+111)) then
        tmp = t_1
    else if (y <= 1.05d-63) then
        tmp = x * (t + (z * 2.0d0))
    else if (y <= 2.9d+94) 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.4e+111) {
		tmp = t_1;
	} else if (y <= 1.05e-63) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 2.9e+94) {
		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.4e+111:
		tmp = t_1
	elif y <= 1.05e-63:
		tmp = x * (t + (z * 2.0))
	elif y <= 2.9e+94:
		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.4e+111)
		tmp = t_1;
	elseif (y <= 1.05e-63)
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	elseif (y <= 2.9e+94)
		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.4e+111)
		tmp = t_1;
	elseif (y <= 1.05e-63)
		tmp = x * (t + (z * 2.0));
	elseif (y <= 2.9e+94)
		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.4e+111], t$95$1, If[LessEqual[y, 1.05e-63], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+94], 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.4 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 2.9 \cdot 10^{+94}:\\
\;\;\;\;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.4e111 or 2.8999999999999998e94 < 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.2%

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

    if -1.4e111 < y < 1.05e-63

    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-def100.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 83.6%

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

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

    if 1.05e-63 < y < 2.8999999999999998e94

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+111}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+94}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 89.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{-73} \lor \neg \left(x \leq 3.7 \cdot 10^{-38}\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.15e-73) (not (<= x 3.7e-38)))
   (* 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.15e-73) || !(x <= 3.7e-38)) {
		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.15d-73)) .or. (.not. (x <= 3.7d-38))) 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.15e-73) || !(x <= 3.7e-38)) {
		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.15e-73) or not (x <= 3.7e-38):
		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.15e-73) || !(x <= 3.7e-38))
		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.15e-73) || ~((x <= 3.7e-38)))
		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.15e-73], N[Not[LessEqual[x, 3.7e-38]], $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 \cdot 10^{-73} \lor \neg \left(x \leq 3.7 \cdot 10^{-38}\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.14999999999999994e-73 or 3.7e-38 < 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-def100.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.0%

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

    if -1.14999999999999994e-73 < x < 3.7e-38

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{-73} \lor \neg \left(x \leq 3.7 \cdot 10^{-38}\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 10: 77.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+111} \lor \neg \left(y \leq 6.1 \cdot 10^{-18}\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 -2.35e+111) (not (<= y 6.1e-18)))
   (* 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 <= -2.35e+111) || !(y <= 6.1e-18)) {
		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 <= (-2.35d+111)) .or. (.not. (y <= 6.1d-18))) 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 <= -2.35e+111) || !(y <= 6.1e-18)) {
		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 <= -2.35e+111) or not (y <= 6.1e-18):
		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 <= -2.35e+111) || !(y <= 6.1e-18))
		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 <= -2.35e+111) || ~((y <= 6.1e-18)))
		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, -2.35e+111], N[Not[LessEqual[y, 6.1e-18]], $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 -2.35 \cdot 10^{+111} \lor \neg \left(y \leq 6.1 \cdot 10^{-18}\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 < -2.35000000000000004e111 or 6.0999999999999999e-18 < 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 82.9%

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

    if -2.35000000000000004e111 < y < 6.0999999999999999e-18

    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-def100.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 81.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+111} \lor \neg \left(y \leq 6.1 \cdot 10^{-18}\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: 45.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-87} \lor \neg \left(x \leq 4 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.99999999999999915e-87 or 3.99999999999999977e-29 < 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-def100.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 94.4%

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified37.7%

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

    if -8.99999999999999915e-87 < x < 3.99999999999999977e-29

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified61.0%

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

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

Alternative 13: 31.6% 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-def100.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 70.6%

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

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

      \[\leadsto \color{blue}{x \cdot t} \]
  8. Simplified30.0%

    \[\leadsto \color{blue}{x \cdot t} \]
  9. Final simplification30.0%

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

Reproduce

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