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

Percentage Accurate: 99.8% → 99.9%
Time: 6.1s
Alternatives: 16
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 16 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Derivation
  1. Initial program 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. Final simplification99.9%

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

Alternative 3: 59.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.95 \cdot 10^{-81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-111}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-189}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-279}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-144}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))) (t_2 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -1.95e-81)
     t_2
     (if (<= y -1.4e-111)
       (* x t)
       (if (<= y -4.5e-138)
         t_1
         (if (<= y -1e-189)
           (* x t)
           (if (<= y -5.2e-279)
             t_1
             (if (<= y 6.6e-144) (* x t) (if (<= y 1.45e-95) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.95e-81) {
		tmp = t_2;
	} else if (y <= -1.4e-111) {
		tmp = x * t;
	} else if (y <= -4.5e-138) {
		tmp = t_1;
	} else if (y <= -1e-189) {
		tmp = x * t;
	} else if (y <= -5.2e-279) {
		tmp = t_1;
	} else if (y <= 6.6e-144) {
		tmp = x * t;
	} else if (y <= 1.45e-95) {
		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 = 2.0d0 * (x * z)
    t_2 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-1.95d-81)) then
        tmp = t_2
    else if (y <= (-1.4d-111)) then
        tmp = x * t
    else if (y <= (-4.5d-138)) then
        tmp = t_1
    else if (y <= (-1d-189)) then
        tmp = x * t
    else if (y <= (-5.2d-279)) then
        tmp = t_1
    else if (y <= 6.6d-144) then
        tmp = x * t
    else if (y <= 1.45d-95) 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 = 2.0 * (x * z);
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.95e-81) {
		tmp = t_2;
	} else if (y <= -1.4e-111) {
		tmp = x * t;
	} else if (y <= -4.5e-138) {
		tmp = t_1;
	} else if (y <= -1e-189) {
		tmp = x * t;
	} else if (y <= -5.2e-279) {
		tmp = t_1;
	} else if (y <= 6.6e-144) {
		tmp = x * t;
	} else if (y <= 1.45e-95) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	t_2 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -1.95e-81:
		tmp = t_2
	elif y <= -1.4e-111:
		tmp = x * t
	elif y <= -4.5e-138:
		tmp = t_1
	elif y <= -1e-189:
		tmp = x * t
	elif y <= -5.2e-279:
		tmp = t_1
	elif y <= 6.6e-144:
		tmp = x * t
	elif y <= 1.45e-95:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -1.95e-81)
		tmp = t_2;
	elseif (y <= -1.4e-111)
		tmp = Float64(x * t);
	elseif (y <= -4.5e-138)
		tmp = t_1;
	elseif (y <= -1e-189)
		tmp = Float64(x * t);
	elseif (y <= -5.2e-279)
		tmp = t_1;
	elseif (y <= 6.6e-144)
		tmp = Float64(x * t);
	elseif (y <= 1.45e-95)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	t_2 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -1.95e-81)
		tmp = t_2;
	elseif (y <= -1.4e-111)
		tmp = x * t;
	elseif (y <= -4.5e-138)
		tmp = t_1;
	elseif (y <= -1e-189)
		tmp = x * t;
	elseif (y <= -5.2e-279)
		tmp = t_1;
	elseif (y <= 6.6e-144)
		tmp = x * t;
	elseif (y <= 1.45e-95)
		tmp = t_1;
	else
		tmp = t_2;
	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[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.95e-81], t$95$2, If[LessEqual[y, -1.4e-111], N[(x * t), $MachinePrecision], If[LessEqual[y, -4.5e-138], t$95$1, If[LessEqual[y, -1e-189], N[(x * t), $MachinePrecision], If[LessEqual[y, -5.2e-279], t$95$1, If[LessEqual[y, 6.6e-144], N[(x * t), $MachinePrecision], If[LessEqual[y, 1.45e-95], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.4 \cdot 10^{-111}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;y \leq -4.5 \cdot 10^{-138}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1 \cdot 10^{-189}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;y \leq -5.2 \cdot 10^{-279}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{-144}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-95}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.94999999999999992e-81 or 1.45000000000000001e-95 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -1.94999999999999992e-81 < y < -1.39999999999999998e-111 or -4.50000000000000008e-138 < y < -1.00000000000000007e-189 or -5.2000000000000004e-279 < y < 6.5999999999999999e-144

    1. Initial program 100.0%

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

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

    if -1.39999999999999998e-111 < y < -4.50000000000000008e-138 or -1.00000000000000007e-189 < y < -5.2000000000000004e-279 or 6.5999999999999999e-144 < y < 1.45000000000000001e-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 z around inf 80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{-81}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-111}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-138}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-189}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-279}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-144}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-95}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 4: 47.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ t_2 := y \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.76 \cdot 10^{+17}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+79}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.35 \cdot 10^{+183}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))) (t_2 (* y (* x 2.0))))
   (if (<= x -1.02e+120)
     t_1
     (if (<= x -1.76e+17)
       t_2
       (if (<= x -5.5e-17)
         t_1
         (if (<= x 3.6e-11)
           (* y 5.0)
           (if (<= x 1.6e+79) (* x t) (if (<= x 3.35e+183) t_2 (* x t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double t_2 = y * (x * 2.0);
	double tmp;
	if (x <= -1.02e+120) {
		tmp = t_1;
	} else if (x <= -1.76e+17) {
		tmp = t_2;
	} else if (x <= -5.5e-17) {
		tmp = t_1;
	} else if (x <= 3.6e-11) {
		tmp = y * 5.0;
	} else if (x <= 1.6e+79) {
		tmp = x * t;
	} else if (x <= 3.35e+183) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    t_2 = y * (x * 2.0d0)
    if (x <= (-1.02d+120)) then
        tmp = t_1
    else if (x <= (-1.76d+17)) then
        tmp = t_2
    else if (x <= (-5.5d-17)) then
        tmp = t_1
    else if (x <= 3.6d-11) then
        tmp = y * 5.0d0
    else if (x <= 1.6d+79) then
        tmp = x * t
    else if (x <= 3.35d+183) then
        tmp = t_2
    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 t_2 = y * (x * 2.0);
	double tmp;
	if (x <= -1.02e+120) {
		tmp = t_1;
	} else if (x <= -1.76e+17) {
		tmp = t_2;
	} else if (x <= -5.5e-17) {
		tmp = t_1;
	} else if (x <= 3.6e-11) {
		tmp = y * 5.0;
	} else if (x <= 1.6e+79) {
		tmp = x * t;
	} else if (x <= 3.35e+183) {
		tmp = t_2;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	t_2 = y * (x * 2.0)
	tmp = 0
	if x <= -1.02e+120:
		tmp = t_1
	elif x <= -1.76e+17:
		tmp = t_2
	elif x <= -5.5e-17:
		tmp = t_1
	elif x <= 3.6e-11:
		tmp = y * 5.0
	elif x <= 1.6e+79:
		tmp = x * t
	elif x <= 3.35e+183:
		tmp = t_2
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	t_2 = Float64(y * Float64(x * 2.0))
	tmp = 0.0
	if (x <= -1.02e+120)
		tmp = t_1;
	elseif (x <= -1.76e+17)
		tmp = t_2;
	elseif (x <= -5.5e-17)
		tmp = t_1;
	elseif (x <= 3.6e-11)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.6e+79)
		tmp = Float64(x * t);
	elseif (x <= 3.35e+183)
		tmp = t_2;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	t_2 = y * (x * 2.0);
	tmp = 0.0;
	if (x <= -1.02e+120)
		tmp = t_1;
	elseif (x <= -1.76e+17)
		tmp = t_2;
	elseif (x <= -5.5e-17)
		tmp = t_1;
	elseif (x <= 3.6e-11)
		tmp = y * 5.0;
	elseif (x <= 1.6e+79)
		tmp = x * t;
	elseif (x <= 3.35e+183)
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.02e+120], t$95$1, If[LessEqual[x, -1.76e+17], t$95$2, If[LessEqual[x, -5.5e-17], t$95$1, If[LessEqual[x, 3.6e-11], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.6e+79], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.35e+183], t$95$2, N[(x * t), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.76 \cdot 10^{+17}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-17}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 1.6 \cdot 10^{+79}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 3.35 \cdot 10^{+183}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.01999999999999997e120 or -1.76e17 < x < -5.50000000000000001e-17

    1. Initial program 100.0%

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

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

    if -1.01999999999999997e120 < x < -1.76e17 or 1.60000000000000001e79 < x < 3.3499999999999998e183

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000001e-17 < x < 3.59999999999999985e-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. Taylor expanded in x around 0 64.7%

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

    if 3.59999999999999985e-11 < x < 1.60000000000000001e79 or 3.3499999999999998e183 < 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. Taylor expanded in t around inf 63.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+120}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -1.76 \cdot 10^{+17}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-17}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+79}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.35 \cdot 10^{+183}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 5: 75.5% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;y \leq 5.8 \cdot 10^{+52}:\\
\;\;\;\;x \cdot t + y \cdot 5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.9999999999999999e-81 or 1.10000000000000001e121 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -1.9999999999999999e-81 < y < 3.09999999999999992e-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 0 89.9%

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

    if 3.09999999999999992e-95 < y < 5.8e52

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8e52 < y < 1.10000000000000001e121

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-81}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+52}:\\ \;\;\;\;x \cdot t + y \cdot 5\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+121}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 6: 87.8% accurate, 1.0× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.35e12 or 3.8000000000000001e-17 < 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. Taylor expanded in x around inf 98.1%

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

    if -1.35e12 < x < 2.29999999999999988e-211

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, \color{blue}{2 \cdot \left(z \cdot x\right)}\right) \]
    5. Step-by-step derivation
      1. fma-udef88.2%

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

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

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

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

    if 2.29999999999999988e-211 < x < 3.8000000000000001e-17

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1350000000000:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-211}:\\ \;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-17}:\\ \;\;\;\;x \cdot t + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]

Alternative 7: 85.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{+164} \lor \neg \left(t \leq 36000000000000\right):\\
\;\;\;\;x \cdot t + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.12000000000000006e164 or 3.6e13 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.12000000000000006e164 < t < 3.6e13

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 8: 87.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+66} \lor \neg \left(t \leq 7.6 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot t + y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.44999999999999988e66 or 7.6e16 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -2.44999999999999988e66 < t < 7.6e16

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 9: 88.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+65}:\\
\;\;\;\;x \cdot t + y \cdot \left(5 + x \cdot 2\right)\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.7e65 < t < 4.2e14

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if 4.2e14 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.7 \cdot 10^{+65}:\\ \;\;\;\;x \cdot t + y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{+14}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]

Alternative 10: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 11: 47.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -1.46 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-15}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+107}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+158}:\\ \;\;\;\;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 (<= x -1.46e-15)
     t_1
     (if (<= x 4.8e-15)
       (* y 5.0)
       (if (<= x 1.25e+107) (* x t) (if (<= x 6e+158) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -1.46e-15) {
		tmp = t_1;
	} else if (x <= 4.8e-15) {
		tmp = y * 5.0;
	} else if (x <= 1.25e+107) {
		tmp = x * t;
	} else if (x <= 6e+158) {
		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 (x <= (-1.46d-15)) then
        tmp = t_1
    else if (x <= 4.8d-15) then
        tmp = y * 5.0d0
    else if (x <= 1.25d+107) then
        tmp = x * t
    else if (x <= 6d+158) 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 (x <= -1.46e-15) {
		tmp = t_1;
	} else if (x <= 4.8e-15) {
		tmp = y * 5.0;
	} else if (x <= 1.25e+107) {
		tmp = x * t;
	} else if (x <= 6e+158) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -1.46e-15:
		tmp = t_1
	elif x <= 4.8e-15:
		tmp = y * 5.0
	elif x <= 1.25e+107:
		tmp = x * t
	elif x <= 6e+158:
		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 (x <= -1.46e-15)
		tmp = t_1;
	elseif (x <= 4.8e-15)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.25e+107)
		tmp = Float64(x * t);
	elseif (x <= 6e+158)
		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 (x <= -1.46e-15)
		tmp = t_1;
	elseif (x <= 4.8e-15)
		tmp = y * 5.0;
	elseif (x <= 1.25e+107)
		tmp = x * t;
	elseif (x <= 6e+158)
		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[x, -1.46e-15], t$95$1, If[LessEqual[x, 4.8e-15], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.25e+107], N[(x * t), $MachinePrecision], If[LessEqual[x, 6e+158], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 4.8 \cdot 10^{-15}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{+107}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.4600000000000001e-15 or 1.25e107 < x < 6e158

    1. Initial program 100.0%

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

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

    if -1.4600000000000001e-15 < x < 4.7999999999999999e-15

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

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

    if 4.7999999999999999e-15 < x < 1.25e107 or 6e158 < 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. Taylor expanded in t around inf 59.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.46 \cdot 10^{-15}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-15}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+107}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+158}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 12: 89.3% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.19999999999999962e-15 or 2.64999999999999986e-19 < 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. Taylor expanded in x around inf 97.8%

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

    if -4.19999999999999962e-15 < x < 2.64999999999999986e-19

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 63.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-11} \lor \neg \left(x \leq 1.05 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.5e-11 or 1.04999999999999997e-12 < 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. Taylor expanded in z around 0 72.5%

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

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

    if -4.5e-11 < x < 1.04999999999999997e-12

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 14: 75.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-81} \lor \neg \left(y \leq 1.1 \cdot 10^{-36}\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 -2e-81) (not (<= y 1.1e-36)))
   (* 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 <= -2e-81) || !(y <= 1.1e-36)) {
		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 <= (-2d-81)) .or. (.not. (y <= 1.1d-36))) 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 <= -2e-81) || !(y <= 1.1e-36)) {
		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 <= -2e-81) or not (y <= 1.1e-36):
		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 <= -2e-81) || !(y <= 1.1e-36))
		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 <= -2e-81) || ~((y <= 1.1e-36)))
		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, -2e-81], N[Not[LessEqual[y, 1.1e-36]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-81} \lor \neg \left(y \leq 1.1 \cdot 10^{-36}\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 < -1.9999999999999999e-81 or 1.1e-36 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -1.9999999999999999e-81 < y < 1.1e-36

    1. Initial program 100.0%

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

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

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

Alternative 15: 47.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-13}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -8.2e-13) (* x t) (if (<= x 6.5e-11) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -8.2e-13) {
		tmp = x * t;
	} else if (x <= 6.5e-11) {
		tmp = y * 5.0;
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-8.2d-13)) then
        tmp = x * t
    else if (x <= 6.5d-11) then
        tmp = y * 5.0d0
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -8.2e-13) {
		tmp = x * t;
	} else if (x <= 6.5e-11) {
		tmp = y * 5.0;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -8.2e-13:
		tmp = x * t
	elif x <= 6.5e-11:
		tmp = y * 5.0
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -8.2e-13)
		tmp = Float64(x * t);
	elseif (x <= 6.5e-11)
		tmp = Float64(y * 5.0);
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -8.2e-13)
		tmp = x * t;
	elseif (x <= 6.5e-11)
		tmp = y * 5.0;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.2e-13], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.5e-11], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.2000000000000004e-13 or 6.49999999999999953e-11 < 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 t around inf 35.8%

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

    if -8.2000000000000004e-13 < x < 6.49999999999999953e-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. Taylor expanded in x around 0 64.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-13}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 16: 29.7% accurate, 5.0× speedup?

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

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

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

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

    \[\leadsto y \cdot 5 \]

Reproduce

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