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

Percentage Accurate: 99.9% → 99.9%
Time: 12.4s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. fma-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. Final simplification99.9%

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

Alternative 2: 48.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq -2.2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{-12}:\\
\;\;\;\;x \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.8999999999999998e120 or -2.1999999999999999e47 < x < -7.2e-12

    1. Initial program 100.0%

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

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

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

    if -3.8999999999999998e120 < x < -2.1999999999999999e47 or 8.50000000000000037e-11 < x

    1. Initial program 100.0%

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

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

    if -7.2e-12 < x < 8.50000000000000037e-11

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+120}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{+47}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-12}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.2% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.1999999999999999e109 or 1.15e27 < y < 1.80000000000000004e155

    1. Initial program 99.9%

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

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

    if -2.1999999999999999e109 < y < 1.15e27

    1. Initial program 99.9%

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

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

    if 1.80000000000000004e155 < 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 x around inf 65.3%

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

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

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

Alternative 4: 63.5% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq 2.7 \cdot 10^{+181}:\\
\;\;\;\;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 y < -1.45000000000000014e117 or 8.49999999999999954e28 < y < 2.70000000000000007e181

    1. Initial program 99.9%

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

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

    if -1.45000000000000014e117 < y < 8.49999999999999954e28

    1. Initial program 99.9%

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

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

    if 2.70000000000000007e181 < 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 x around inf 65.7%

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

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

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

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

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

Alternative 5: 88.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-27} \lor \neg \left(x \leq 1.45 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.50000000000000029e-27 or 1.4500000000000001e-12 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-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.8%

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

    if -7.50000000000000029e-27 < x < 1.4500000000000001e-12

    1. Initial program 99.8%

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

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

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

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

Alternative 6: 89.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+74} \lor \neg \left(t \leq 5.8 \cdot 10^{+88}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5e74 or 5.7999999999999999e88 < t

    1. Initial program 99.9%

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

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

    if -4.5e74 < t < 5.7999999999999999e88

    1. Initial program 99.9%

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

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

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

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

Alternative 7: 87.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+90}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\

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

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


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

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l+100.0%

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

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

        \[\leadsto x \cdot \left(\color{blue}{\frac{\left(y + z\right) \cdot \left(y + z\right) - \left(y + z\right) \cdot \left(y + z\right)}{\left(y + z\right) - \left(y + z\right)}} + t\right) + y \cdot 5 \]
      4. pow20.0%

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

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

      \[\leadsto x \cdot \left(\color{blue}{\frac{{\left(y + z\right)}^{2} - {\left(y + z\right)}^{2}}{\left(y + z\right) - \left(y + z\right)}} + t\right) + y \cdot 5 \]
    5. Simplified93.7%

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

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

    if -5.49999999999999999e90 < t < 3.09999999999999998e91

    1. Initial program 99.9%

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

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

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

    if 3.09999999999999998e91 < t

    1. Initial program 99.8%

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

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

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

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

Alternative 8: 47.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+121}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -2.5:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

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

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


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

    1. Initial program 100.0%

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

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

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

    if -3.59999999999999981e121 < x < -2.5

    1. Initial program 100.0%

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

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

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

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

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

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

    if -2.5 < x < 5.7999999999999995e-13

    1. Initial program 99.8%

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

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

    if 5.7999999999999995e-13 < x

    1. Initial program 99.9%

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

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

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

Alternative 9: 98.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+33}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.9999999999999999e33

    1. Initial program 99.9%

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

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

    if 1.9999999999999999e33 < 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 2 regimes into one program.
  4. Final simplification98.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2 \cdot 10^{+33}:\\ \;\;\;\;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 10: 88.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{-17} \lor \neg \left(x \leq 8.5 \cdot 10^{-12}\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-17) (not (<= x 8.5e-12)))
   (* 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-17) || !(x <= 8.5e-12)) {
		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-17)) .or. (.not. (x <= 8.5d-12))) 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-17) || !(x <= 8.5e-12)) {
		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-17) or not (x <= 8.5e-12):
		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-17) || !(x <= 8.5e-12))
		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-17) || ~((x <= 8.5e-12)))
		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-17], N[Not[LessEqual[x, 8.5e-12]], $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^{-17} \lor \neg \left(x \leq 8.5 \cdot 10^{-12}\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.49999999999999978e-17 or 8.4999999999999997e-12 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-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.8%

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

    if -4.49999999999999978e-17 < x < 8.4999999999999997e-12

    1. Initial program 99.8%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l+99.8%

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

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

        \[\leadsto x \cdot \left(\color{blue}{\frac{\left(y + z\right) \cdot \left(y + z\right) - \left(y + z\right) \cdot \left(y + z\right)}{\left(y + z\right) - \left(y + z\right)}} + t\right) + y \cdot 5 \]
      4. pow20.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{-17} \lor \neg \left(x \leq 8.5 \cdot 10^{-12}\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 11: 63.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{-22} \lor \neg \left(x \leq 1.55 \cdot 10^{-12}\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 -3.2e-22) (not (<= x 1.55e-12)))
   (* x (* 2.0 (+ y z)))
   (* y 5.0)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -3.2e-22) || !(x <= 1.55e-12)) {
		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 <= (-3.2d-22)) .or. (.not. (x <= 1.55d-12))) 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 <= -3.2e-22) || !(x <= 1.55e-12)) {
		tmp = x * (2.0 * (y + z));
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -3.2e-22) or not (x <= 1.55e-12):
		tmp = x * (2.0 * (y + z))
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -3.2e-22) || !(x <= 1.55e-12))
		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 <= -3.2e-22) || ~((x <= 1.55e-12)))
		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, -3.2e-22], N[Not[LessEqual[x, 1.55e-12]], $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 -3.2 \cdot 10^{-22} \lor \neg \left(x \leq 1.55 \cdot 10^{-12}\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 < -3.19999999999999987e-22 or 1.5500000000000001e-12 < x

    1. Initial program 100.0%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-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.8%

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

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

    if -3.19999999999999987e-22 < x < 1.5500000000000001e-12

    1. Initial program 99.8%

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

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

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

Alternative 12: 77.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+108} \lor \neg \left(y \leq 7000000000\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 -4.2e+108) (not (<= y 7000000000.0)))
   (* 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 <= -4.2e+108) || !(y <= 7000000000.0)) {
		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 <= (-4.2d+108)) .or. (.not. (y <= 7000000000.0d0))) 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 <= -4.2e+108) || !(y <= 7000000000.0)) {
		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 <= -4.2e+108) or not (y <= 7000000000.0):
		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 <= -4.2e+108) || !(y <= 7000000000.0))
		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 <= -4.2e+108) || ~((y <= 7000000000.0)))
		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, -4.2e+108], N[Not[LessEqual[y, 7000000000.0]], $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 -4.2 \cdot 10^{+108} \lor \neg \left(y \leq 7000000000\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 < -4.20000000000000019e108 or 7e9 < y

    1. Initial program 99.9%

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

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

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

    if -4.20000000000000019e108 < y < 7e9

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+108} \lor \neg \left(y \leq 7000000000\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 13: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 14: 47.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-13} \lor \neg \left(x \leq 1.4 \cdot 10^{-11}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.69999999999999989e-13 or 1.4e-11 < x

    1. Initial program 100.0%

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

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

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

    if -3.69999999999999989e-13 < x < 1.4e-11

    1. Initial program 99.8%

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

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

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

Alternative 15: 30.3% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{5 \cdot y} \]
  4. Final simplification30.2%

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

Reproduce

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