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

Percentage Accurate: 99.8% → 99.9%
Time: 6.9s
Alternatives: 13
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 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.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.5%

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

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

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

      \[\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+94.1%

      \[\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. +-commutative94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 42.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(z \cdot 2\right)\\ \mathbf{if}\;y \leq -5.3 \cdot 10^{+188}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{+148}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+74}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-238}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (* z 2.0))))
   (if (<= y -5.3e+188)
     (* y 5.0)
     (if (<= y -2.2e+148)
       (* y (* x 2.0))
       (if (<= y -7.2e+74)
         (* y 5.0)
         (if (<= y -4.4e-19)
           t_1
           (if (<= y -2e-238)
             (* x t)
             (if (<= y 4.2e-119)
               t_1
               (if (<= y 3.1e+45) (* x t) (* y 5.0))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (z * 2.0);
	double tmp;
	if (y <= -5.3e+188) {
		tmp = y * 5.0;
	} else if (y <= -2.2e+148) {
		tmp = y * (x * 2.0);
	} else if (y <= -7.2e+74) {
		tmp = y * 5.0;
	} else if (y <= -4.4e-19) {
		tmp = t_1;
	} else if (y <= -2e-238) {
		tmp = x * t;
	} else if (y <= 4.2e-119) {
		tmp = t_1;
	} else if (y <= 3.1e+45) {
		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) :: t_1
    real(8) :: tmp
    t_1 = x * (z * 2.0d0)
    if (y <= (-5.3d+188)) then
        tmp = y * 5.0d0
    else if (y <= (-2.2d+148)) then
        tmp = y * (x * 2.0d0)
    else if (y <= (-7.2d+74)) then
        tmp = y * 5.0d0
    else if (y <= (-4.4d-19)) then
        tmp = t_1
    else if (y <= (-2d-238)) then
        tmp = x * t
    else if (y <= 4.2d-119) then
        tmp = t_1
    else if (y <= 3.1d+45) 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 t_1 = x * (z * 2.0);
	double tmp;
	if (y <= -5.3e+188) {
		tmp = y * 5.0;
	} else if (y <= -2.2e+148) {
		tmp = y * (x * 2.0);
	} else if (y <= -7.2e+74) {
		tmp = y * 5.0;
	} else if (y <= -4.4e-19) {
		tmp = t_1;
	} else if (y <= -2e-238) {
		tmp = x * t;
	} else if (y <= 4.2e-119) {
		tmp = t_1;
	} else if (y <= 3.1e+45) {
		tmp = x * t;
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (z * 2.0)
	tmp = 0
	if y <= -5.3e+188:
		tmp = y * 5.0
	elif y <= -2.2e+148:
		tmp = y * (x * 2.0)
	elif y <= -7.2e+74:
		tmp = y * 5.0
	elif y <= -4.4e-19:
		tmp = t_1
	elif y <= -2e-238:
		tmp = x * t
	elif y <= 4.2e-119:
		tmp = t_1
	elif y <= 3.1e+45:
		tmp = x * t
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(z * 2.0))
	tmp = 0.0
	if (y <= -5.3e+188)
		tmp = Float64(y * 5.0);
	elseif (y <= -2.2e+148)
		tmp = Float64(y * Float64(x * 2.0));
	elseif (y <= -7.2e+74)
		tmp = Float64(y * 5.0);
	elseif (y <= -4.4e-19)
		tmp = t_1;
	elseif (y <= -2e-238)
		tmp = Float64(x * t);
	elseif (y <= 4.2e-119)
		tmp = t_1;
	elseif (y <= 3.1e+45)
		tmp = Float64(x * t);
	else
		tmp = Float64(y * 5.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (z * 2.0);
	tmp = 0.0;
	if (y <= -5.3e+188)
		tmp = y * 5.0;
	elseif (y <= -2.2e+148)
		tmp = y * (x * 2.0);
	elseif (y <= -7.2e+74)
		tmp = y * 5.0;
	elseif (y <= -4.4e-19)
		tmp = t_1;
	elseif (y <= -2e-238)
		tmp = x * t;
	elseif (y <= 4.2e-119)
		tmp = t_1;
	elseif (y <= 3.1e+45)
		tmp = x * t;
	else
		tmp = y * 5.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.3e+188], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -2.2e+148], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.2e+74], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -4.4e-19], t$95$1, If[LessEqual[y, -2e-238], N[(x * t), $MachinePrecision], If[LessEqual[y, 4.2e-119], t$95$1, If[LessEqual[y, 3.1e+45], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.2 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;y \leq -7.2 \cdot 10^{+74}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;y \leq -4.4 \cdot 10^{-19}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -2 \cdot 10^{-238}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;y \leq 4.2 \cdot 10^{-119}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.29999999999999988e188 or -2.1999999999999999e148 < y < -7.19999999999999975e74 or 3.09999999999999988e45 < y

    1. Initial program 98.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 53.0%

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

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

    if -5.29999999999999988e188 < y < -2.1999999999999999e148

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -7.19999999999999975e74 < y < -4.3999999999999997e-19 or -2e-238 < y < 4.2e-119

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*62.1%

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

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

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

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

    if -4.3999999999999997e-19 < y < -2e-238 or 4.2e-119 < y < 3.09999999999999988e45

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified52.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.3 \cdot 10^{+188}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{+148}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+74}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{elif}\;y \leq -2 \cdot 10^{-238}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-119}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 4: 64.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+187}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;y \leq -8.3 \cdot 10^{+93}:\\
\;\;\;\;y \cdot 5\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.79999999999999989e187 or -6.9999999999999998e148 < y < -8.2999999999999997e93 or 1.35999999999999995e119 < y

    1. Initial program 98.6%

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

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

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

    if -2.79999999999999989e187 < y < -6.9999999999999998e148

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -8.2999999999999997e93 < y < 7.00000000000000059e63

    1. Initial program 99.9%

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

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

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

    if 7.00000000000000059e63 < y < 1.35999999999999995e119

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
      7. *-commutative66.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+187}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -8.3 \cdot 10^{+93}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.36 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 5: 98.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1e148

    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 x around inf 99.9%

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

    if -1e148 < x

    1. Initial program 99.5%

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

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

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

Alternative 6: 64.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+187}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;y \leq -2.15 \cdot 10^{+96}:\\
\;\;\;\;y \cdot 5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.74999999999999999e187 or -6.9999999999999998e148 < y < -2.15000000000000001e96 or 8.00000000000000073e106 < y

    1. Initial program 98.7%

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

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

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

    if -2.74999999999999999e187 < y < -6.9999999999999998e148

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -2.15000000000000001e96 < y < 8.00000000000000073e106

    1. Initial program 99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.75 \cdot 10^{+187}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.15 \cdot 10^{+96}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+106}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 7: 99.8% 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.5%

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

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

Alternative 8: 42.9% accurate, 1.1× speedup?

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

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

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

\mathbf{elif}\;y \leq -1.35 \cdot 10^{-244}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.00000000000000029e74 or 4.1999999999999999e45 < y

    1. Initial program 99.0%

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

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

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

    if -7.00000000000000029e74 < y < -3.59999999999999989e-21 or -1.35e-244 < y < 1.45000000000000002e-113

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*62.1%

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

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

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

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

    if -3.59999999999999989e-21 < y < -1.35e-244 or 1.45000000000000002e-113 < y < 4.1999999999999999e45

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified52.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+74}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-21}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-244}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-113}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 9: 89.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-16} \lor \neg \left(x \leq 1.18 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.4e-16 or 1.17999999999999996e-26 < 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}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -3.4e-16 < x < 1.17999999999999996e-26

    1. Initial program 99.1%

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

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

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

Alternative 10: 88.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-21} \lor \neg \left(x \leq 4.1 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.30000000000000009e-21 or 4.0999999999999999e-26 < 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}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -3.30000000000000009e-21 < x < 4.0999999999999999e-26

    1. Initial program 99.1%

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

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

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

Alternative 11: 78.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{+28} \lor \neg \left(y \leq 5 \cdot 10^{+51}\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 -2.1e+28) (not (<= y 5e+51)))
   (* 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 <= -2.1e+28) || !(y <= 5e+51)) {
		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 <= (-2.1d+28)) .or. (.not. (y <= 5d+51))) 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 <= -2.1e+28) || !(y <= 5e+51)) {
		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 <= -2.1e+28) or not (y <= 5e+51):
		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 <= -2.1e+28) || !(y <= 5e+51))
		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 <= -2.1e+28) || ~((y <= 5e+51)))
		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, -2.1e+28], N[Not[LessEqual[y, 5e+51]], $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.1 \cdot 10^{+28} \lor \neg \left(y \leq 5 \cdot 10^{+51}\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 < -2.09999999999999989e28 or 5e51 < y

    1. Initial program 99.1%

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

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

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

    if -2.09999999999999989e28 < y < 5e51

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

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

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

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

Alternative 12: 47.8% accurate, 2.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.4999999999999994e-21 or 9.50000000000000058e-23 < x

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified34.4%

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

    if -9.4999999999999994e-21 < x < 9.50000000000000058e-23

    1. Initial program 99.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{-21}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-23}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 13: 31.3% 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.5%

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

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

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

      \[\leadsto \color{blue}{x \cdot t} \]
  5. Simplified27.4%

    \[\leadsto \color{blue}{x \cdot t} \]
  6. Final simplification27.4%

    \[\leadsto x \cdot t \]

Reproduce

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