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

Percentage Accurate: 99.9% → 100.0%
Time: 8.9s
Alternatives: 13
Speedup: 1.2×

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: 100.0% accurate, 0.1× speedup?

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

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

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

      \[\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. associate-+l+100.0%

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
    4. *-un-lft-identity100.0%

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
    6. *-un-lft-identity100.0%

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

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

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

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

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

Alternative 2: 64.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ t_2 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -5.4 \cdot 10^{+30}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{+15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-7}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq -1.6 \cdot 10^{-150}\right) \land x \leq 6.8 \cdot 10^{-8}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* z 2.0)))) (t_2 (* x (+ t (* y 2.0)))))
   (if (<= x -5.4e+30)
     t_2
     (if (<= x -4.2e+15)
       t_1
       (if (<= x -1.8e-7)
         t_2
         (if (or (<= x -5.5e-25) (and (not (<= x -1.6e-150)) (<= x 6.8e-8)))
           (* y 5.0)
           t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -5.4e+30) {
		tmp = t_2;
	} else if (x <= -4.2e+15) {
		tmp = t_1;
	} else if (x <= -1.8e-7) {
		tmp = t_2;
	} else if ((x <= -5.5e-25) || (!(x <= -1.6e-150) && (x <= 6.8e-8))) {
		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) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (z * 2.0d0))
    t_2 = x * (t + (y * 2.0d0))
    if (x <= (-5.4d+30)) then
        tmp = t_2
    else if (x <= (-4.2d+15)) then
        tmp = t_1
    else if (x <= (-1.8d-7)) then
        tmp = t_2
    else if ((x <= (-5.5d-25)) .or. (.not. (x <= (-1.6d-150))) .and. (x <= 6.8d-8)) then
        tmp = y * 5.0d0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -5.4e+30) {
		tmp = t_2;
	} else if (x <= -4.2e+15) {
		tmp = t_1;
	} else if (x <= -1.8e-7) {
		tmp = t_2;
	} else if ((x <= -5.5e-25) || (!(x <= -1.6e-150) && (x <= 6.8e-8))) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (z * 2.0))
	t_2 = x * (t + (y * 2.0))
	tmp = 0
	if x <= -5.4e+30:
		tmp = t_2
	elif x <= -4.2e+15:
		tmp = t_1
	elif x <= -1.8e-7:
		tmp = t_2
	elif (x <= -5.5e-25) or (not (x <= -1.6e-150) and (x <= 6.8e-8)):
		tmp = y * 5.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(z * 2.0)))
	t_2 = Float64(x * Float64(t + Float64(y * 2.0)))
	tmp = 0.0
	if (x <= -5.4e+30)
		tmp = t_2;
	elseif (x <= -4.2e+15)
		tmp = t_1;
	elseif (x <= -1.8e-7)
		tmp = t_2;
	elseif ((x <= -5.5e-25) || (!(x <= -1.6e-150) && (x <= 6.8e-8)))
		tmp = Float64(y * 5.0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (z * 2.0));
	t_2 = x * (t + (y * 2.0));
	tmp = 0.0;
	if (x <= -5.4e+30)
		tmp = t_2;
	elseif (x <= -4.2e+15)
		tmp = t_1;
	elseif (x <= -1.8e-7)
		tmp = t_2;
	elseif ((x <= -5.5e-25) || (~((x <= -1.6e-150)) && (x <= 6.8e-8)))
		tmp = y * 5.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.4e+30], t$95$2, If[LessEqual[x, -4.2e+15], t$95$1, If[LessEqual[x, -1.8e-7], t$95$2, If[Or[LessEqual[x, -5.5e-25], And[N[Not[LessEqual[x, -1.6e-150]], $MachinePrecision], LessEqual[x, 6.8e-8]]], N[(y * 5.0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.8 \cdot 10^{-7}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq -1.6 \cdot 10^{-150}\right) \land x \leq 6.8 \cdot 10^{-8}:\\
\;\;\;\;y \cdot 5\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.3999999999999997e30 or -4.2e15 < x < -1.79999999999999997e-7

    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 inf 81.6%

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

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

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

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

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

    if -5.3999999999999997e30 < x < -4.2e15 or -5.50000000000000004e-25 < x < -1.5999999999999999e-150 or 6.8e-8 < 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. Taylor expanded in y around 0 74.3%

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

    if -1.79999999999999997e-7 < x < -5.50000000000000004e-25 or -1.5999999999999999e-150 < x < 6.8e-8

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+30}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-7}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq -1.6 \cdot 10^{-150}\right) \land x \leq 6.8 \cdot 10^{-8}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]

Alternative 3: 86.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;t \leq -2.9 \cdot 10^{+232}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq -4.1 \cdot 10^{+76} \lor \neg \left(t \leq 4.3 \cdot 10^{+73}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.90000000000000023e232 or -3.05e159 < t < -4.0999999999999998e76 or 4.30000000000000013e73 < t

    1. Initial program 99.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(z + y\right)}, x, t \cdot x\right) + y \cdot 5 \]
      4. *-un-lft-identity98.7%

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

        \[\leadsto \mathsf{fma}\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}, x, t \cdot x\right) + y \cdot 5 \]
      6. *-un-lft-identity98.7%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) \cdot \left(1 + 1\right)}, x, t \cdot x\right) + y \cdot 5 \]
      8. metadata-eval98.7%

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

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

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

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

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

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

    if -2.90000000000000023e232 < t < -3.05e159

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

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

    if -4.0999999999999998e76 < t < 4.30000000000000013e73

    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. +-commutative99.9%

        \[\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. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.9 \cdot 10^{+232}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;t \leq -3.05 \cdot 10^{+159}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;t \leq -4.1 \cdot 10^{+76} \lor \neg \left(t \leq 4.3 \cdot 10^{+73}\right):\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\ \end{array} \]

Alternative 4: 64.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.36 \cdot 10^{-9} \lor \neg \left(x \leq -6.5 \cdot 10^{-25}\right) \land \left(x \leq -1.55 \cdot 10^{-150} \lor \neg \left(x \leq 6.8 \cdot 10^{-8}\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 -1.36e-9)
         (and (not (<= x -6.5e-25))
              (or (<= x -1.55e-150) (not (<= x 6.8e-8)))))
   (* x (+ t (* z 2.0)))
   (* y 5.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.36e-9) || (!(x <= -6.5e-25) && ((x <= -1.55e-150) || !(x <= 6.8e-8)))) {
		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 <= (-1.36d-9)) .or. (.not. (x <= (-6.5d-25))) .and. (x <= (-1.55d-150)) .or. (.not. (x <= 6.8d-8))) 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 <= -1.36e-9) || (!(x <= -6.5e-25) && ((x <= -1.55e-150) || !(x <= 6.8e-8)))) {
		tmp = x * (t + (z * 2.0));
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.36e-9) or (not (x <= -6.5e-25) and ((x <= -1.55e-150) or not (x <= 6.8e-8))):
		tmp = x * (t + (z * 2.0))
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.36e-9) || (!(x <= -6.5e-25) && ((x <= -1.55e-150) || !(x <= 6.8e-8))))
		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 <= -1.36e-9) || (~((x <= -6.5e-25)) && ((x <= -1.55e-150) || ~((x <= 6.8e-8)))))
		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, -1.36e-9], And[N[Not[LessEqual[x, -6.5e-25]], $MachinePrecision], Or[LessEqual[x, -1.55e-150], N[Not[LessEqual[x, 6.8e-8]], $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 -1.36 \cdot 10^{-9} \lor \neg \left(x \leq -6.5 \cdot 10^{-25}\right) \land \left(x \leq -1.55 \cdot 10^{-150} \lor \neg \left(x \leq 6.8 \cdot 10^{-8}\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 < -1.36000000000000006e-9 or -6.5e-25 < x < -1.54999999999999999e-150 or 6.8e-8 < 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. Taylor expanded in y around 0 71.2%

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

    if -1.36000000000000006e-9 < x < -6.5e-25 or -1.54999999999999999e-150 < x < 6.8e-8

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.36 \cdot 10^{-9} \lor \neg \left(x \leq -6.5 \cdot 10^{-25}\right) \land \left(x \leq -1.55 \cdot 10^{-150} \lor \neg \left(x \leq 6.8 \cdot 10^{-8}\right)\right):\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 5: 76.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+15} \lor \neg \left(y \leq 2 \cdot 10^{-45} \lor \neg \left(y \leq 2.8 \cdot 10^{-17}\right) \land y \leq 1.9 \cdot 10^{+124}\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.5e+15)
         (not (or (<= y 2e-45) (and (not (<= y 2.8e-17)) (<= y 1.9e+124)))))
   (* 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.5e+15) || !((y <= 2e-45) || (!(y <= 2.8e-17) && (y <= 1.9e+124)))) {
		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.5d+15)) .or. (.not. (y <= 2d-45) .or. (.not. (y <= 2.8d-17)) .and. (y <= 1.9d+124))) 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.5e+15) || !((y <= 2e-45) || (!(y <= 2.8e-17) && (y <= 1.9e+124)))) {
		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.5e+15) or not ((y <= 2e-45) or (not (y <= 2.8e-17) and (y <= 1.9e+124))):
		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.5e+15) || !((y <= 2e-45) || (!(y <= 2.8e-17) && (y <= 1.9e+124))))
		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.5e+15) || ~(((y <= 2e-45) || (~((y <= 2.8e-17)) && (y <= 1.9e+124)))))
		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.5e+15], N[Not[Or[LessEqual[y, 2e-45], And[N[Not[LessEqual[y, 2.8e-17]], $MachinePrecision], LessEqual[y, 1.9e+124]]]], $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.5 \cdot 10^{+15} \lor \neg \left(y \leq 2 \cdot 10^{-45} \lor \neg \left(y \leq 2.8 \cdot 10^{-17}\right) \land y \leq 1.9 \cdot 10^{+124}\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.5e15 or 1.99999999999999997e-45 < y < 2.7999999999999999e-17 or 1.8999999999999999e124 < 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. Taylor expanded in y around inf 90.0%

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

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

    if -7.5e15 < y < 1.99999999999999997e-45 or 2.7999999999999999e-17 < y < 1.8999999999999999e124

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+15} \lor \neg \left(y \leq 2 \cdot 10^{-45} \lor \neg \left(y \leq 2.8 \cdot 10^{-17}\right) \land y \leq 1.9 \cdot 10^{+124}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]

Alternative 6: 77.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 2.6 \cdot 10^{-55}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+124}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.3e28 or 1.8999999999999999e124 < 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. Taylor expanded in y around inf 89.9%

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

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

    if -3.3e28 < y < 2.5999999999999999e-55 or 1.45e-18 < y < 1.8999999999999999e124

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

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

    if 2.5999999999999999e-55 < y < 1.45e-18

    1. Initial program 99.8%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. distribute-rgt-in99.8%

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(z + y\right)}, x, t \cdot x\right) + y \cdot 5 \]
      4. *-un-lft-identity99.8%

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

        \[\leadsto \mathsf{fma}\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}, x, t \cdot x\right) + y \cdot 5 \]
      6. *-un-lft-identity99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    5. Step-by-step derivation
      1. *-commutative98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{+28}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-55}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-18}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+124}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 7: 77.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 6.8 \cdot 10^{-55}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+124}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.2e19

    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 y around inf 85.0%

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

    if -5.2e19 < y < 6.79999999999999946e-55 or 1.15e-16 < y < 1.8999999999999999e124

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

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

    if 6.79999999999999946e-55 < y < 1.15e-16

    1. Initial program 99.8%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. distribute-rgt-in99.8%

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) + \left(z + y\right)}, x, t \cdot x\right) + y \cdot 5 \]
      4. *-un-lft-identity99.8%

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

        \[\leadsto \mathsf{fma}\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}, x, t \cdot x\right) + y \cdot 5 \]
      6. *-un-lft-identity99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    5. Step-by-step derivation
      1. *-commutative98.4%

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

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

    if 1.8999999999999999e124 < 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. Taylor expanded in y around inf 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+19}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-55}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+124}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 8: 88.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+96} \lor \neg \left(z \leq 6.8 \cdot 10^{+25}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.9e96 or 6.79999999999999967e25 < z

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. +-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. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

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

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

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

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

    if -3.9e96 < z < 6.79999999999999967e25

    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 y around inf 93.7%

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

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

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

Alternative 9: 89.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+97} \lor \neg \left(z \leq 5.6 \cdot 10^{+25}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.4e97 or 5.6000000000000003e25 < z

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. +-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. associate-+l+100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

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

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

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

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

    if -1.4e97 < z < 5.6000000000000003e25

    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 y around inf 93.7%

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

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

Alternative 10: 99.9% accurate, 1.2× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. associate-+l+99.9%

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

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

      \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right) + y \cdot 5 \]
    4. *-un-lft-identity99.9%

      \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right) + y \cdot 5 \]
    5. distribute-rgt-out99.9%

      \[\leadsto x \cdot \left(\color{blue}{\left(y + z\right) \cdot \left(1 + 1\right)} + t\right) + y \cdot 5 \]
    6. metadata-eval99.9%

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

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

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

Alternative 11: 46.2% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq 5.8 \cdot 10^{-277}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 1.04 \cdot 10^{-141}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\

\mathbf{elif}\;t \leq 1.8 \cdot 10^{-9}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.7500000000000001e48 or 1.8e-9 < t

    1. Initial program 99.9%

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

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

    if -2.7500000000000001e48 < t < 5.79999999999999955e-277 or 1.04e-141 < t < 1.8e-9

    1. Initial program 99.8%

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

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

    if 5.79999999999999955e-277 < t < 1.04e-141

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.75 \cdot 10^{+48}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-277}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 1.04 \cdot 10^{-141}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 12: 45.1% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.55 \cdot 10^{+51} \lor \neg \left(t \leq 1.25 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.55000000000000005e51 or 1.2499999999999999e-8 < t

    1. Initial program 99.9%

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

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

    if -2.55000000000000005e51 < t < 1.2499999999999999e-8

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

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

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

Alternative 13: 29.4% accurate, 5.0× speedup?

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

\\
y \cdot 5
\end{array}
Derivation
  1. Initial program 99.9%

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

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

    \[\leadsto y \cdot 5 \]

Reproduce

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