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

Percentage Accurate: 99.9% → 99.9%
Time: 10.3s
Alternatives: 10
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 10 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(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma x (+ (+ y (+ z z)) (+ y t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
	return fma(x, ((y + (z + z)) + (y + t)), (y * 5.0));
}
function code(x, y, z, t)
	return fma(x, Float64(Float64(y + Float64(z + z)) + Float64(y + t)), Float64(y * 5.0))
end
code[x_, y_, z_, t_] := N[(x * N[(N[(y + N[(z + z), $MachinePrecision]), $MachinePrecision] + N[(y + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), 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) + z\right) + \left(y + t\right)}, y \cdot 5\right) \]
    3. associate-+l+100.0%

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

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

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

Alternative 2: 45.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot y\right)\\ \mathbf{if}\;x \leq -9.6 \cdot 10^{+242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+168}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1.12 \cdot 10^{+42}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-113}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-108}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{+68} \lor \neg \left(x \leq 1.8 \cdot 10^{+114}\right) \land x \leq 1.02 \cdot 10^{+239}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x y))))
   (if (<= x -9.6e+242)
     t_1
     (if (<= x -2.7e+168)
       (* x t)
       (if (<= x -1.12e+42)
         t_1
         (if (<= x -3.4e-113)
           (* x t)
           (if (<= x 3.5e-108)
             (* y 5.0)
             (if (or (<= x 1.85e+68)
                     (and (not (<= x 1.8e+114)) (<= x 1.02e+239)))
               (* x t)
               t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * y);
	double tmp;
	if (x <= -9.6e+242) {
		tmp = t_1;
	} else if (x <= -2.7e+168) {
		tmp = x * t;
	} else if (x <= -1.12e+42) {
		tmp = t_1;
	} else if (x <= -3.4e-113) {
		tmp = x * t;
	} else if (x <= 3.5e-108) {
		tmp = y * 5.0;
	} else if ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239))) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (x * y)
    if (x <= (-9.6d+242)) then
        tmp = t_1
    else if (x <= (-2.7d+168)) then
        tmp = x * t
    else if (x <= (-1.12d+42)) then
        tmp = t_1
    else if (x <= (-3.4d-113)) then
        tmp = x * t
    else if (x <= 3.5d-108) then
        tmp = y * 5.0d0
    else if ((x <= 1.85d+68) .or. (.not. (x <= 1.8d+114)) .and. (x <= 1.02d+239)) then
        tmp = x * t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * y);
	double tmp;
	if (x <= -9.6e+242) {
		tmp = t_1;
	} else if (x <= -2.7e+168) {
		tmp = x * t;
	} else if (x <= -1.12e+42) {
		tmp = t_1;
	} else if (x <= -3.4e-113) {
		tmp = x * t;
	} else if (x <= 3.5e-108) {
		tmp = y * 5.0;
	} else if ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239))) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * y)
	tmp = 0
	if x <= -9.6e+242:
		tmp = t_1
	elif x <= -2.7e+168:
		tmp = x * t
	elif x <= -1.12e+42:
		tmp = t_1
	elif x <= -3.4e-113:
		tmp = x * t
	elif x <= 3.5e-108:
		tmp = y * 5.0
	elif (x <= 1.85e+68) or (not (x <= 1.8e+114) and (x <= 1.02e+239)):
		tmp = x * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * y))
	tmp = 0.0
	if (x <= -9.6e+242)
		tmp = t_1;
	elseif (x <= -2.7e+168)
		tmp = Float64(x * t);
	elseif (x <= -1.12e+42)
		tmp = t_1;
	elseif (x <= -3.4e-113)
		tmp = Float64(x * t);
	elseif (x <= 3.5e-108)
		tmp = Float64(y * 5.0);
	elseif ((x <= 1.85e+68) || (!(x <= 1.8e+114) && (x <= 1.02e+239)))
		tmp = Float64(x * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * y);
	tmp = 0.0;
	if (x <= -9.6e+242)
		tmp = t_1;
	elseif (x <= -2.7e+168)
		tmp = x * t;
	elseif (x <= -1.12e+42)
		tmp = t_1;
	elseif (x <= -3.4e-113)
		tmp = x * t;
	elseif (x <= 3.5e-108)
		tmp = y * 5.0;
	elseif ((x <= 1.85e+68) || (~((x <= 1.8e+114)) && (x <= 1.02e+239)))
		tmp = x * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.6e+242], t$95$1, If[LessEqual[x, -2.7e+168], N[(x * t), $MachinePrecision], If[LessEqual[x, -1.12e+42], t$95$1, If[LessEqual[x, -3.4e-113], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.5e-108], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.85e+68], And[N[Not[LessEqual[x, 1.8e+114]], $MachinePrecision], LessEqual[x, 1.02e+239]]], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -2.7 \cdot 10^{+168}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -1.12 \cdot 10^{+42}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -3.4 \cdot 10^{-113}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 1.85 \cdot 10^{+68} \lor \neg \left(x \leq 1.8 \cdot 10^{+114}\right) \land x \leq 1.02 \cdot 10^{+239}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.60000000000000049e242 or -2.70000000000000016e168 < x < -1.12e42 or 1.84999999999999999e68 < x < 1.8e114 or 1.02e239 < 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 inf 54.7%

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

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

    if -9.60000000000000049e242 < x < -2.70000000000000016e168 or -1.12e42 < x < -3.4000000000000002e-113 or 3.4999999999999999e-108 < x < 1.84999999999999999e68 or 1.8e114 < x < 1.02e239

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

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

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

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

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

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

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

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

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

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

    if -3.4000000000000002e-113 < x < 3.4999999999999999e-108

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.6 \cdot 10^{+242}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+168}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1.12 \cdot 10^{+42}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-113}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-108}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{+68} \lor \neg \left(x \leq 1.8 \cdot 10^{+114}\right) \land x \leq 1.02 \cdot 10^{+239}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \end{array} \]

Alternative 3: 85.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.95 \lor \neg \left(y \leq 3.1 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(y + \left(y + t\right)\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 < -0.94999999999999996 or 3.1e-31 < y

    1. Initial program 100.0%

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

      \[\leadsto x \cdot \left(\left(\color{blue}{y} + y\right) + t\right) + y \cdot 5 \]
    3. Step-by-step derivation
      1. associate-+l+86.4%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(y + t\right)\right)} + y \cdot 5 \]
      2. distribute-lft-in83.3%

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

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

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

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

    if -0.94999999999999996 < y < 3.1e-31

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

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

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

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

Alternative 4: 93.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+55} \lor \neg \left(y \leq 4.8 \cdot 10^{+107}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(y + \left(y + t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.3999999999999998e55 or 4.8000000000000001e107 < 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 93.6%

      \[\leadsto x \cdot \left(\left(\color{blue}{y} + y\right) + t\right) + y \cdot 5 \]
    3. Step-by-step derivation
      1. associate-+l+93.6%

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

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

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

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

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

    if -3.3999999999999998e55 < y < 4.8000000000000001e107

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

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

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

Alternative 5: 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 6: 43.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;t \leq 1.35 \cdot 10^{-170}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 2.65 \cdot 10^{-95}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;t \leq 3.6 \cdot 10^{+101}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.4000000000000001e167 or 3.60000000000000029e101 < 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 y around 0 95.1%

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

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

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

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

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

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

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

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

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

    if -5.4000000000000001e167 < t < 1.3499999999999999e-170 or 2.6499999999999999e-95 < t < 3.60000000000000029e101

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

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

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

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

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

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

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

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

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

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

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

    if 1.3499999999999999e-170 < t < 2.6499999999999999e-95

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.4 \cdot 10^{+167}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{-170}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;t \leq 2.65 \cdot 10^{-95}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+101}:\\ \;\;\;\;z \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 7: 65.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-209} \lor \neg \left(x \leq 2.9 \cdot 10^{-135}\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.7e-209) (not (<= x 2.9e-135)))
   (* x (+ t (* z 2.0)))
   (* y 5.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.7e-209) || !(x <= 2.9e-135)) {
		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.7d-209)) .or. (.not. (x <= 2.9d-135))) 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.7e-209) || !(x <= 2.9e-135)) {
		tmp = x * (t + (z * 2.0));
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.7e-209) or not (x <= 2.9e-135):
		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.7e-209) || !(x <= 2.9e-135))
		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.7e-209) || ~((x <= 2.9e-135)))
		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.7e-209], N[Not[LessEqual[x, 2.9e-135]], $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.7 \cdot 10^{-209} \lor \neg \left(x \leq 2.9 \cdot 10^{-135}\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.69999999999999994e-209 or 2.9000000000000002e-135 < 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 80.5%

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

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

    if -1.69999999999999994e-209 < x < 2.9000000000000002e-135

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

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

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

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

Alternative 8: 78.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -780 \lor \neg \left(y \leq 6.2 \cdot 10^{+106}\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 -780.0) (not (<= y 6.2e+106)))
   (* 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 <= -780.0) || !(y <= 6.2e+106)) {
		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 <= (-780.0d0)) .or. (.not. (y <= 6.2d+106))) 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 <= -780.0) || !(y <= 6.2e+106)) {
		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 <= -780.0) or not (y <= 6.2e+106):
		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 <= -780.0) || !(y <= 6.2e+106))
		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 <= -780.0) || ~((y <= 6.2e+106)))
		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, -780.0], N[Not[LessEqual[y, 6.2e+106]], $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 -780 \lor \neg \left(y \leq 6.2 \cdot 10^{+106}\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 < -780 or 6.1999999999999999e106 < y

    1. Initial program 100.0%

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

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

    if -780 < y < 6.1999999999999999e106

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

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

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

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

Alternative 9: 46.7% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-109} \lor \neg \left(x \leq 8.8 \cdot 10^{-107}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.6000000000000003e-109 or 8.8000000000000005e-107 < 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 78.2%

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

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

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

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

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

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

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

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

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

    if -4.6000000000000003e-109 < x < 8.8000000000000005e-107

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{-109} \lor \neg \left(x \leq 8.8 \cdot 10^{-107}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 10: 31.4% 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 y around 0 84.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot t \]

Reproduce

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