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

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

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

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

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

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

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

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

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

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

Alternative 2: 57.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ t_2 := y \cdot \left(x + 5\right)\\ t_3 := x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{if}\;z \leq -5.6 \cdot 10^{+140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+125}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{+118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+80}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-186}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-300}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 6.7 \cdot 10^{+50}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z)))
        (t_2 (* y (+ x 5.0)))
        (t_3 (* x (+ t (* 2.0 y)))))
   (if (<= z -5.6e+140)
     t_1
     (if (<= z -1.8e+125)
       t_3
       (if (<= z -1.1e+118)
         t_1
         (if (<= z -5.2e+80)
           t_2
           (if (<= z -3.1e-186)
             t_3
             (if (<= z -5.2e-300) t_2 (if (<= z 6.7e+50) t_3 t_1)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double t_2 = y * (x + 5.0);
	double t_3 = x * (t + (2.0 * y));
	double tmp;
	if (z <= -5.6e+140) {
		tmp = t_1;
	} else if (z <= -1.8e+125) {
		tmp = t_3;
	} else if (z <= -1.1e+118) {
		tmp = t_1;
	} else if (z <= -5.2e+80) {
		tmp = t_2;
	} else if (z <= -3.1e-186) {
		tmp = t_3;
	} else if (z <= -5.2e-300) {
		tmp = t_2;
	} else if (z <= 6.7e+50) {
		tmp = t_3;
	} 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) :: t_3
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    t_2 = y * (x + 5.0d0)
    t_3 = x * (t + (2.0d0 * y))
    if (z <= (-5.6d+140)) then
        tmp = t_1
    else if (z <= (-1.8d+125)) then
        tmp = t_3
    else if (z <= (-1.1d+118)) then
        tmp = t_1
    else if (z <= (-5.2d+80)) then
        tmp = t_2
    else if (z <= (-3.1d-186)) then
        tmp = t_3
    else if (z <= (-5.2d-300)) then
        tmp = t_2
    else if (z <= 6.7d+50) then
        tmp = t_3
    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 * z);
	double t_2 = y * (x + 5.0);
	double t_3 = x * (t + (2.0 * y));
	double tmp;
	if (z <= -5.6e+140) {
		tmp = t_1;
	} else if (z <= -1.8e+125) {
		tmp = t_3;
	} else if (z <= -1.1e+118) {
		tmp = t_1;
	} else if (z <= -5.2e+80) {
		tmp = t_2;
	} else if (z <= -3.1e-186) {
		tmp = t_3;
	} else if (z <= -5.2e-300) {
		tmp = t_2;
	} else if (z <= 6.7e+50) {
		tmp = t_3;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	t_2 = y * (x + 5.0)
	t_3 = x * (t + (2.0 * y))
	tmp = 0
	if z <= -5.6e+140:
		tmp = t_1
	elif z <= -1.8e+125:
		tmp = t_3
	elif z <= -1.1e+118:
		tmp = t_1
	elif z <= -5.2e+80:
		tmp = t_2
	elif z <= -3.1e-186:
		tmp = t_3
	elif z <= -5.2e-300:
		tmp = t_2
	elif z <= 6.7e+50:
		tmp = t_3
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	t_2 = Float64(y * Float64(x + 5.0))
	t_3 = Float64(x * Float64(t + Float64(2.0 * y)))
	tmp = 0.0
	if (z <= -5.6e+140)
		tmp = t_1;
	elseif (z <= -1.8e+125)
		tmp = t_3;
	elseif (z <= -1.1e+118)
		tmp = t_1;
	elseif (z <= -5.2e+80)
		tmp = t_2;
	elseif (z <= -3.1e-186)
		tmp = t_3;
	elseif (z <= -5.2e-300)
		tmp = t_2;
	elseif (z <= 6.7e+50)
		tmp = t_3;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	t_2 = y * (x + 5.0);
	t_3 = x * (t + (2.0 * y));
	tmp = 0.0;
	if (z <= -5.6e+140)
		tmp = t_1;
	elseif (z <= -1.8e+125)
		tmp = t_3;
	elseif (z <= -1.1e+118)
		tmp = t_1;
	elseif (z <= -5.2e+80)
		tmp = t_2;
	elseif (z <= -3.1e-186)
		tmp = t_3;
	elseif (z <= -5.2e-300)
		tmp = t_2;
	elseif (z <= 6.7e+50)
		tmp = t_3;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x + 5.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.6e+140], t$95$1, If[LessEqual[z, -1.8e+125], t$95$3, If[LessEqual[z, -1.1e+118], t$95$1, If[LessEqual[z, -5.2e+80], t$95$2, If[LessEqual[z, -3.1e-186], t$95$3, If[LessEqual[z, -5.2e-300], t$95$2, If[LessEqual[z, 6.7e+50], t$95$3, t$95$1]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.8 \cdot 10^{+125}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -1.1 \cdot 10^{+118}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -5.2 \cdot 10^{+80}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -3.1 \cdot 10^{-186}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -5.2 \cdot 10^{-300}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 6.7 \cdot 10^{+50}:\\
\;\;\;\;t_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.59999999999999966e140 or -1.8000000000000002e125 < z < -1.09999999999999993e118 or 6.6999999999999999e50 < 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. Add Preprocessing
    3. Taylor expanded in z around inf 71.9%

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

    if -5.59999999999999966e140 < z < -1.8000000000000002e125 or -5.19999999999999963e80 < z < -3.10000000000000009e-186 or -5.19999999999999993e-300 < z < 6.6999999999999999e50

    1. Initial program 99.9%

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

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

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

    if -1.09999999999999993e118 < z < -5.19999999999999963e80 or -3.10000000000000009e-186 < z < -5.19999999999999993e-300

    1. Initial program 99.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{+140}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+125}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{+118}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+80}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-186}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-300}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;z \leq 6.7 \cdot 10^{+50}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot z\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.08 \cdot 10^{+161}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+107}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* 2.0 z)))) (t_2 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -1.08e+161)
     t_2
     (if (<= y -1.35e+62)
       t_1
       (if (<= y -9.5e-14)
         t_2
         (if (<= y 3.7e-53)
           t_1
           (if (<= y 8.5e-11)
             (+ (* y 5.0) (* x t))
             (if (<= y 1.4e+107) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * z));
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.08e+161) {
		tmp = t_2;
	} else if (y <= -1.35e+62) {
		tmp = t_1;
	} else if (y <= -9.5e-14) {
		tmp = t_2;
	} else if (y <= 3.7e-53) {
		tmp = t_1;
	} else if (y <= 8.5e-11) {
		tmp = (y * 5.0) + (x * t);
	} else if (y <= 1.4e+107) {
		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 + (2.0d0 * z))
    t_2 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-1.08d+161)) then
        tmp = t_2
    else if (y <= (-1.35d+62)) then
        tmp = t_1
    else if (y <= (-9.5d-14)) then
        tmp = t_2
    else if (y <= 3.7d-53) then
        tmp = t_1
    else if (y <= 8.5d-11) then
        tmp = (y * 5.0d0) + (x * t)
    else if (y <= 1.4d+107) 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 + (2.0 * z));
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.08e+161) {
		tmp = t_2;
	} else if (y <= -1.35e+62) {
		tmp = t_1;
	} else if (y <= -9.5e-14) {
		tmp = t_2;
	} else if (y <= 3.7e-53) {
		tmp = t_1;
	} else if (y <= 8.5e-11) {
		tmp = (y * 5.0) + (x * t);
	} else if (y <= 1.4e+107) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * z))
	t_2 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -1.08e+161:
		tmp = t_2
	elif y <= -1.35e+62:
		tmp = t_1
	elif y <= -9.5e-14:
		tmp = t_2
	elif y <= 3.7e-53:
		tmp = t_1
	elif y <= 8.5e-11:
		tmp = (y * 5.0) + (x * t)
	elif y <= 1.4e+107:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * z)))
	t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -1.08e+161)
		tmp = t_2;
	elseif (y <= -1.35e+62)
		tmp = t_1;
	elseif (y <= -9.5e-14)
		tmp = t_2;
	elseif (y <= 3.7e-53)
		tmp = t_1;
	elseif (y <= 8.5e-11)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	elseif (y <= 1.4e+107)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * z));
	t_2 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -1.08e+161)
		tmp = t_2;
	elseif (y <= -1.35e+62)
		tmp = t_1;
	elseif (y <= -9.5e-14)
		tmp = t_2;
	elseif (y <= 3.7e-53)
		tmp = t_1;
	elseif (y <= 8.5e-11)
		tmp = (y * 5.0) + (x * t);
	elseif (y <= 1.4e+107)
		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[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.08e+161], t$95$2, If[LessEqual[y, -1.35e+62], t$95$1, If[LessEqual[y, -9.5e-14], t$95$2, If[LessEqual[y, 3.7e-53], t$95$1, If[LessEqual[y, 8.5e-11], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+107], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.35 \cdot 10^{+62}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -9.5 \cdot 10^{-14}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+107}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.08e161 or -1.35e62 < y < -9.4999999999999999e-14 or 1.39999999999999992e107 < 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. Add Preprocessing
    3. Taylor expanded in y around inf 86.3%

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

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

    if -1.08e161 < y < -1.35e62 or -9.4999999999999999e-14 < y < 3.69999999999999982e-53 or 8.50000000000000037e-11 < y < 1.39999999999999992e107

    1. Initial program 100.0%

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

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

    if 3.69999999999999982e-53 < y < 8.50000000000000037e-11

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.08 \cdot 10^{+161}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{-53}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+107}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 52.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -2.9 \cdot 10^{+62}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq -3.6 \cdot 10^{-20}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-285}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-213}:\\
\;\;\;\;t_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2999999999999999e130 or -2.89999999999999984e62 < y < -3.59999999999999974e-20 or 5.0000000000000003e-34 < 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. Add Preprocessing
    3. Taylor expanded in y around 0 91.0%

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

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

    if -1.2999999999999999e130 < y < -2.89999999999999984e62 or 3.60000000000000004e-285 < y < 3.6000000000000001e-213

    1. Initial program 99.9%

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

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

    if -3.59999999999999974e-20 < y < 3.60000000000000004e-285 or 3.6000000000000001e-213 < y < 5.0000000000000003e-34

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified54.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+130}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{+62}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-20}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-285}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-213}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-34}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 75.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{+161} \lor \neg \left(y \leq -2.05 \cdot 10^{+62} \lor \neg \left(y \leq -1.2 \cdot 10^{-13}\right) \land y \leq 7 \cdot 10^{+99}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.08e161 or -2.04999999999999992e62 < y < -1.1999999999999999e-13 or 6.9999999999999995e99 < 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. Add Preprocessing
    3. Taylor expanded in y around inf 86.3%

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

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

    if -1.08e161 < y < -2.04999999999999992e62 or -1.1999999999999999e-13 < y < 6.9999999999999995e99

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.08 \cdot 10^{+161} \lor \neg \left(y \leq -2.05 \cdot 10^{+62} \lor \neg \left(y \leq -1.2 \cdot 10^{-13}\right) \land y \leq 7 \cdot 10^{+99}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 46.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 3.7 \cdot 10^{-51}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 1.35 \cdot 10^{-11}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 5.6 \cdot 10^{+31}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.7000000000000002e72 or 5.60000000000000034e31 < 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. Add Preprocessing
    3. Taylor expanded in t around inf 62.7%

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified62.7%

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

    if -3.7000000000000002e72 < t < 3.69999999999999973e-51 or 1.35000000000000002e-11 < t < 5.60000000000000034e31

    1. Initial program 99.9%

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

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

    if 3.69999999999999973e-51 < t < 1.35000000000000002e-11

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.7 \cdot 10^{+72}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{-51}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 5.6 \cdot 10^{+31}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+31} \lor \neg \left(x \leq 4.7 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.9999999999999999e31 or 4.7e-7 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -3.9999999999999999e31 < x < 4.7e-7

    1. Initial program 99.9%

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

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

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

Alternative 8: 86.5% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.02e11 < t < 9.9999999999999997e34

    1. Initial program 99.9%

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

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

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

    if 9.9999999999999997e34 < 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. Add Preprocessing
    3. Taylor expanded in y around inf 87.7%

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

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

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

Alternative 9: 89.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-15} \lor \neg \left(x \leq 2.7 \cdot 10^{-38}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.50000000000000007e-15 or 2.70000000000000005e-38 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -8.50000000000000007e-15 < x < 2.70000000000000005e-38

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 87.7% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.09999999999999997e-106 or 1.09999999999999995e-29 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.09999999999999997e-106 < x < 1.09999999999999995e-29

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 72.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{+161} \lor \neg \left(y \leq 1.08 \cdot 10^{+136}\right):\\
\;\;\;\;y \cdot \left(x + 5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.08e161 or 1.07999999999999994e136 < 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. Add Preprocessing
    3. Taylor expanded in y around 0 95.0%

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

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

    if -1.08e161 < y < 1.07999999999999994e136

    1. Initial program 99.9%

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

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

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

Alternative 12: 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 99.9%

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Add Preprocessing
  3. Final simplification99.9%

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

Alternative 13: 47.1% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.4999999999999999e-107 or 3.0999999999999997e-39 < x

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified39.1%

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

    if -9.4999999999999999e-107 < x < 3.0999999999999997e-39

    1. Initial program 99.9%

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

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

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

Alternative 14: 30.2% 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. Add Preprocessing
  3. Taylor expanded in x around 0 25.6%

    \[\leadsto \color{blue}{5 \cdot y} \]
  4. Final simplification25.6%

    \[\leadsto y \cdot 5 \]
  5. Add Preprocessing

Reproduce

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