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

Percentage Accurate: 99.9% → 99.7%
Time: 7.1s
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.7% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999995e-50

    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-define100.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 100.0%

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

    if -1.49999999999999995e-50 < x < 1.99999999999999996e109

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

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

    if 1.99999999999999996e109 < 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-define100.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 100.0%

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

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

Alternative 2: 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-define99.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. Add Preprocessing

Alternative 3: 94.3% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.60000000000000005e238

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

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

    if -4.60000000000000005e238 < y < 5.20000000000000016e60

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

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

    if 5.20000000000000016e60 < 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-define99.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. Taylor expanded in t around 0 98.1%

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

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

Alternative 4: 87.0% accurate, 0.6× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.50000000000000019e-6 or 1.10000000000000001e-129 < 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-define100.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 96.5%

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

    if -7.50000000000000019e-6 < x < -3.2e-130

    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-define99.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. Taylor expanded in t around 0 85.9%

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

    if -3.2e-130 < x < 1.10000000000000001e-129

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

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

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

Alternative 5: 87.0% accurate, 0.6× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.9999999999999999e-17 or 1.15e-129 < 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-define100.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.9%

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

    if -4.9999999999999999e-17 < x < -3.5999999999999999e-131

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

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

    if -3.5999999999999999e-131 < x < 1.15e-129

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

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

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

Alternative 6: 64.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.00000000000000007e-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. Step-by-step derivation
      1. fma-define100.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.6%

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

      \[\leadsto x \cdot \color{blue}{\left(2 \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutative77.9%

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

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

    if -1.00000000000000007e-17 < x < 5.0000000000000004e-131

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

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

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

    if 5.0000000000000004e-131 < x < 1.3000000000000001e63

    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-define100.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 83.1%

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

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

    if 1.3000000000000001e63 < 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-define100.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 100.0%

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

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

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

Alternative 7: 46.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-90}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+52}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (* x 2.0))))
   (if (<= x -8.6e-5)
     t_1
     (if (<= x 2.6e-90) (* y 5.0) (if (<= x 1.1e+52) (* x t) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (x * 2.0);
	double tmp;
	if (x <= -8.6e-5) {
		tmp = t_1;
	} else if (x <= 2.6e-90) {
		tmp = y * 5.0;
	} else if (x <= 1.1e+52) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (x * 2.0d0)
    if (x <= (-8.6d-5)) then
        tmp = t_1
    else if (x <= 2.6d-90) then
        tmp = y * 5.0d0
    else if (x <= 1.1d+52) 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 * 2.0);
	double tmp;
	if (x <= -8.6e-5) {
		tmp = t_1;
	} else if (x <= 2.6e-90) {
		tmp = y * 5.0;
	} else if (x <= 1.1e+52) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (x * 2.0)
	tmp = 0
	if x <= -8.6e-5:
		tmp = t_1
	elif x <= 2.6e-90:
		tmp = y * 5.0
	elif x <= 1.1e+52:
		tmp = x * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(x * 2.0))
	tmp = 0.0
	if (x <= -8.6e-5)
		tmp = t_1;
	elseif (x <= 2.6e-90)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.1e+52)
		tmp = Float64(x * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (x * 2.0);
	tmp = 0.0;
	if (x <= -8.6e-5)
		tmp = t_1;
	elseif (x <= 2.6e-90)
		tmp = y * 5.0;
	elseif (x <= 1.1e+52)
		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 * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e-5], t$95$1, If[LessEqual[x, 2.6e-90], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.1e+52], N[(x * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-90}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.1 \cdot 10^{+52}:\\
\;\;\;\;x \cdot t\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.6000000000000003e-5 or 1.1e52 < 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-define100.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 y around inf 47.3%

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

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

    if -8.6000000000000003e-5 < x < 2.6e-90

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

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

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

    if 2.6e-90 < x < 1.1e52

    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-define100.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 84.5%

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

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

      \[\leadsto \color{blue}{t \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative49.0%

        \[\leadsto \color{blue}{x \cdot t} \]
    9. Simplified49.0%

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

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

Alternative 8: 87.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{-20} \lor \neg \left(x \leq 1.15 \cdot 10^{-129}\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 -4.5e-20) (not (<= x 1.15e-129)))
   (* 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 <= -4.5e-20) || !(x <= 1.15e-129)) {
		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 <= (-4.5d-20)) .or. (.not. (x <= 1.15d-129))) 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 <= -4.5e-20) || !(x <= 1.15e-129)) {
		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 <= -4.5e-20) or not (x <= 1.15e-129):
		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 <= -4.5e-20) || !(x <= 1.15e-129))
		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 <= -4.5e-20) || ~((x <= 1.15e-129)))
		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, -4.5e-20], N[Not[LessEqual[x, 1.15e-129]], $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 -4.5 \cdot 10^{-20} \lor \neg \left(x \leq 1.15 \cdot 10^{-129}\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 < -4.5000000000000001e-20 or 1.15e-129 < 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-define100.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.9%

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

    if -4.5000000000000001e-20 < x < 1.15e-129

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{-20} \lor \neg \left(x \leq 1.15 \cdot 10^{-129}\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 9: 77.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+99} \lor \neg \left(y \leq 6.9 \cdot 10^{-16}\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 -7.5e+99) (not (<= y 6.9e-16)))
   (* 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 <= -7.5e+99) || !(y <= 6.9e-16)) {
		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 <= (-7.5d+99)) .or. (.not. (y <= 6.9d-16))) 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 <= -7.5e+99) || !(y <= 6.9e-16)) {
		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 <= -7.5e+99) or not (y <= 6.9e-16):
		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 <= -7.5e+99) || !(y <= 6.9e-16))
		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 <= -7.5e+99) || ~((y <= 6.9e-16)))
		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, -7.5e+99], N[Not[LessEqual[y, 6.9e-16]], $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 -7.5 \cdot 10^{+99} \lor \neg \left(y \leq 6.9 \cdot 10^{-16}\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 < -7.49999999999999963e99 or 6.8999999999999997e-16 < 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-define99.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. Taylor expanded in y around inf 83.6%

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

    if -7.49999999999999963e99 < y < 6.8999999999999997e-16

    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-define100.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 85.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+99} \lor \neg \left(y \leq 6.9 \cdot 10^{-16}\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 10: 61.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-23} \lor \neg \left(x \leq 5.3 \cdot 10^{-130}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.31999999999999994e-23 or 5.3000000000000004e-130 < 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-define100.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.9%

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

      \[\leadsto x \cdot \color{blue}{\left(2 \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutative70.0%

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

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

    if -1.31999999999999994e-23 < x < 5.3000000000000004e-130

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

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

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

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

Alternative 11: 62.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-18}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-90}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.20000000000000021e-18

    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-define100.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.6%

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

      \[\leadsto x \cdot \color{blue}{\left(2 \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutative77.9%

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

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

    if -7.20000000000000021e-18 < x < 2.6e-90

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

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

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

    if 2.6e-90 < 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-define100.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.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{-18}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-90}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot y\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.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-17} \lor \neg \left(x \leq 2.6 \cdot 10^{-90}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.0000000000000003e-17 or 2.6e-90 < 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-define100.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 96.7%

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    9. Simplified35.1%

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

    if -7.0000000000000003e-17 < x < 2.6e-90

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

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

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

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

Alternative 14: 31.5% accurate, 5.0× speedup?

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

\\
x \cdot t
\end{array}
Derivation
  1. Initial program 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-define99.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. Taylor expanded in x around inf 71.9%

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

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

    \[\leadsto \color{blue}{t \cdot x} \]
  8. Step-by-step derivation
    1. *-commutative28.0%

      \[\leadsto \color{blue}{x \cdot t} \]
  9. Simplified28.0%

    \[\leadsto \color{blue}{x \cdot t} \]
  10. Add Preprocessing

Reproduce

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