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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. 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. distribute-rgt-in97.2%

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

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

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

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

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

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

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

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

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

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. Final simplification100.0%

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

Alternative 3: 44.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;t \leq -4 \cdot 10^{+97}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-254}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 3.2 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 52000000000:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))))
   (if (<= t -4e+97)
     (* x t)
     (if (<= t -6e-254)
       t_1
       (if (<= t 2.9e-217)
         (* y 5.0)
         (if (<= t 3.2e-134)
           t_1
           (if (<= t 52000000000.0)
             (* x (* y 2.0))
             (if (<= t 3.1e+62) t_1 (* x t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (t <= -4e+97) {
		tmp = x * t;
	} else if (t <= -6e-254) {
		tmp = t_1;
	} else if (t <= 2.9e-217) {
		tmp = y * 5.0;
	} else if (t <= 3.2e-134) {
		tmp = t_1;
	} else if (t <= 52000000000.0) {
		tmp = x * (y * 2.0);
	} else if (t <= 3.1e+62) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    if (t <= (-4d+97)) then
        tmp = x * t
    else if (t <= (-6d-254)) then
        tmp = t_1
    else if (t <= 2.9d-217) then
        tmp = y * 5.0d0
    else if (t <= 3.2d-134) then
        tmp = t_1
    else if (t <= 52000000000.0d0) then
        tmp = x * (y * 2.0d0)
    else if (t <= 3.1d+62) then
        tmp = t_1
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (t <= -4e+97) {
		tmp = x * t;
	} else if (t <= -6e-254) {
		tmp = t_1;
	} else if (t <= 2.9e-217) {
		tmp = y * 5.0;
	} else if (t <= 3.2e-134) {
		tmp = t_1;
	} else if (t <= 52000000000.0) {
		tmp = x * (y * 2.0);
	} else if (t <= 3.1e+62) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if t <= -4e+97:
		tmp = x * t
	elif t <= -6e-254:
		tmp = t_1
	elif t <= 2.9e-217:
		tmp = y * 5.0
	elif t <= 3.2e-134:
		tmp = t_1
	elif t <= 52000000000.0:
		tmp = x * (y * 2.0)
	elif t <= 3.1e+62:
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (t <= -4e+97)
		tmp = Float64(x * t);
	elseif (t <= -6e-254)
		tmp = t_1;
	elseif (t <= 2.9e-217)
		tmp = Float64(y * 5.0);
	elseif (t <= 3.2e-134)
		tmp = t_1;
	elseif (t <= 52000000000.0)
		tmp = Float64(x * Float64(y * 2.0));
	elseif (t <= 3.1e+62)
		tmp = t_1;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	tmp = 0.0;
	if (t <= -4e+97)
		tmp = x * t;
	elseif (t <= -6e-254)
		tmp = t_1;
	elseif (t <= 2.9e-217)
		tmp = y * 5.0;
	elseif (t <= 3.2e-134)
		tmp = t_1;
	elseif (t <= 52000000000.0)
		tmp = x * (y * 2.0);
	elseif (t <= 3.1e+62)
		tmp = t_1;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e+97], N[(x * t), $MachinePrecision], If[LessEqual[t, -6e-254], t$95$1, If[LessEqual[t, 2.9e-217], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 3.2e-134], t$95$1, If[LessEqual[t, 52000000000.0], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+62], t$95$1, N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -6 \cdot 10^{-254}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 3.2 \cdot 10^{-134}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 52000000000:\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\

\mathbf{elif}\;t \leq 3.1 \cdot 10^{+62}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -4.0000000000000003e97 or 3.10000000000000014e62 < t

    1. Initial program 100.0%

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

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

    if -4.0000000000000003e97 < t < -6.00000000000000023e-254 or 2.89999999999999982e-217 < t < 3.2000000000000001e-134 or 5.2e10 < t < 3.10000000000000014e62

    1. Initial program 99.9%

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

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

    if -6.00000000000000023e-254 < t < 2.89999999999999982e-217

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified45.6%

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

    if 3.2000000000000001e-134 < t < 5.2e10

    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. Taylor expanded in y around 0 92.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4 \cdot 10^{+97}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-254}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 3.2 \cdot 10^{-134}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t \leq 52000000000:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{+62}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 4: 58.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq 9.5 \cdot 10^{-246}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 2.65 \cdot 10^{+70}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.80000000000000009e115 or 2.65e70 < t

    1. Initial program 100.0%

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

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

    if -5.80000000000000009e115 < t < 9.5000000000000002e-246 or 2.89999999999999982e-217 < t < 2.65e70

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

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

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

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

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

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

    if 9.5000000000000002e-246 < t < 2.89999999999999982e-217

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified84.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{+115}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-246}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 2.65 \cdot 10^{+70}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 5: 59.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 2.65 \cdot 10^{+67}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.49999999999999966e115 or 2.65e67 < t

    1. Initial program 100.0%

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

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

    if -6.49999999999999966e115 < t < -4.8999999999999998e-254 or 1.04999999999999991e-205 < t < 2.65e67

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

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

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

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

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

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

    if -4.8999999999999998e-254 < t < 1.04999999999999991e-205

    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. Taylor expanded in y around inf 73.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.5 \cdot 10^{+115}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{-205}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;t \leq 2.65 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 6: 61.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 2.05 \cdot 10^{+61}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.5000000000000004e97 or 2.04999999999999986e61 < t

    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. Taylor expanded in z around 0 89.7%

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

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

    if -7.5000000000000004e97 < t < -4.8999999999999998e-254 or 4e-205 < t < 2.04999999999999986e61

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
    7. Simplified67.0%

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

    if -4.8999999999999998e-254 < t < 4e-205

    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. Taylor expanded in y around inf 73.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.5 \cdot 10^{+97}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;t \leq 4 \cdot 10^{-205}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;t \leq 2.05 \cdot 10^{+61}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]

Alternative 7: 86.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{+15} \lor \neg \left(y \leq 8 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e15 or 8e21 < 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-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. Taylor expanded in t around 0 93.6%

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

    if -2.25e15 < y < 8e21

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

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

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

Alternative 8: 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. Final simplification100.0%

    \[\leadsto y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) \]

Alternative 9: 46.1% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq -3.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 3.1 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.69999999999999993e97 or 1.8000000000000001e69 < t

    1. Initial program 100.0%

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

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

    if -2.69999999999999993e97 < t < -3.9e-254 or 3.0999999999999999e-217 < t < 1.8000000000000001e69

    1. Initial program 99.9%

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

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

    if -3.9e-254 < t < 3.0999999999999999e-217

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified45.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{+97}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -3.9 \cdot 10^{-254}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{-217}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+69}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 10: 82.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+47} \lor \neg \left(y \leq 1.4 \cdot 10^{+60}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.3999999999999999e47 or 1.4e60 < 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-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. Taylor expanded in y around inf 84.5%

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

    if -4.3999999999999999e47 < y < 1.4e60

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{+47} \lor \neg \left(y \leq 1.4 \cdot 10^{+60}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]

Alternative 11: 79.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+47} \lor \neg \left(y \leq 6.5 \cdot 10^{+48}\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 -7.2e+47) (not (<= y 6.5e+48)))
   (* 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 <= -7.2e+47) || !(y <= 6.5e+48)) {
		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 <= (-7.2d+47)) .or. (.not. (y <= 6.5d+48))) 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 <= -7.2e+47) || !(y <= 6.5e+48)) {
		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 <= -7.2e+47) or not (y <= 6.5e+48):
		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 <= -7.2e+47) || !(y <= 6.5e+48))
		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 <= -7.2e+47) || ~((y <= 6.5e+48)))
		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, -7.2e+47], N[Not[LessEqual[y, 6.5e+48]], $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 -7.2 \cdot 10^{+47} \lor \neg \left(y \leq 6.5 \cdot 10^{+48}\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 < -7.20000000000000015e47 or 6.49999999999999972e48 < 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-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. Taylor expanded in y around inf 84.1%

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

    if -7.20000000000000015e47 < y < 6.49999999999999972e48

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+47} \lor \neg \left(y \leq 6.5 \cdot 10^{+48}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]

Alternative 12: 43.7% accurate, 2.1× speedup?

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

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

\mathbf{elif}\;t \leq 1.8 \cdot 10^{+17}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9999999999999999e-36 or 1.8e17 < t

    1. Initial program 100.0%

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

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

    if -1.9999999999999999e-36 < t < 1.8e17

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Simplified34.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{-36}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 13: 30.5% 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. Taylor expanded in t around inf 32.6%

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

    \[\leadsto x \cdot t \]

Reproduce

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