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

Percentage Accurate: 99.9% → 99.9%
Time: 12.6s
Alternatives: 15
Speedup: 0.1×

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

\\
\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)
\end{array}
Derivation
  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) + z\right) + \left(y + t\right)}, y \cdot 5\right) \]
    3. associate-+l+100.0%

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

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

Alternative 2: 62.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ t_2 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -270000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-246}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-242}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+70} \lor \neg \left(x \leq 2 \cdot 10^{+85}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x (+ y z)))) (t_2 (* 2.0 (* x z))))
   (if (<= x -270000000000.0)
     t_1
     (if (<= x -6.3e-89)
       (* x t)
       (if (<= x -2.1e-246)
         (* y 5.0)
         (if (<= x -2e-246)
           t_2
           (if (<= x 3.5e-242)
             (* y 5.0)
             (if (<= x 3.55e-242)
               t_2
               (if (<= x 5.5e-17)
                 (* y 5.0)
                 (if (or (<= x 1.9e+70) (not (<= x 2e+85)))
                   t_1
                   (* x t)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * (y + z));
	double t_2 = 2.0 * (x * z);
	double tmp;
	if (x <= -270000000000.0) {
		tmp = t_1;
	} else if (x <= -6.3e-89) {
		tmp = x * t;
	} else if (x <= -2.1e-246) {
		tmp = y * 5.0;
	} else if (x <= -2e-246) {
		tmp = t_2;
	} else if (x <= 3.5e-242) {
		tmp = y * 5.0;
	} else if (x <= 3.55e-242) {
		tmp = t_2;
	} else if (x <= 5.5e-17) {
		tmp = y * 5.0;
	} else if ((x <= 1.9e+70) || !(x <= 2e+85)) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 * (x * (y + z))
    t_2 = 2.0d0 * (x * z)
    if (x <= (-270000000000.0d0)) then
        tmp = t_1
    else if (x <= (-6.3d-89)) then
        tmp = x * t
    else if (x <= (-2.1d-246)) then
        tmp = y * 5.0d0
    else if (x <= (-2d-246)) then
        tmp = t_2
    else if (x <= 3.5d-242) then
        tmp = y * 5.0d0
    else if (x <= 3.55d-242) then
        tmp = t_2
    else if (x <= 5.5d-17) then
        tmp = y * 5.0d0
    else if ((x <= 1.9d+70) .or. (.not. (x <= 2d+85))) then
        tmp = t_1
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * (y + z));
	double t_2 = 2.0 * (x * z);
	double tmp;
	if (x <= -270000000000.0) {
		tmp = t_1;
	} else if (x <= -6.3e-89) {
		tmp = x * t;
	} else if (x <= -2.1e-246) {
		tmp = y * 5.0;
	} else if (x <= -2e-246) {
		tmp = t_2;
	} else if (x <= 3.5e-242) {
		tmp = y * 5.0;
	} else if (x <= 3.55e-242) {
		tmp = t_2;
	} else if (x <= 5.5e-17) {
		tmp = y * 5.0;
	} else if ((x <= 1.9e+70) || !(x <= 2e+85)) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * (y + z))
	t_2 = 2.0 * (x * z)
	tmp = 0
	if x <= -270000000000.0:
		tmp = t_1
	elif x <= -6.3e-89:
		tmp = x * t
	elif x <= -2.1e-246:
		tmp = y * 5.0
	elif x <= -2e-246:
		tmp = t_2
	elif x <= 3.5e-242:
		tmp = y * 5.0
	elif x <= 3.55e-242:
		tmp = t_2
	elif x <= 5.5e-17:
		tmp = y * 5.0
	elif (x <= 1.9e+70) or not (x <= 2e+85):
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * Float64(y + z)))
	t_2 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (x <= -270000000000.0)
		tmp = t_1;
	elseif (x <= -6.3e-89)
		tmp = Float64(x * t);
	elseif (x <= -2.1e-246)
		tmp = Float64(y * 5.0);
	elseif (x <= -2e-246)
		tmp = t_2;
	elseif (x <= 3.5e-242)
		tmp = Float64(y * 5.0);
	elseif (x <= 3.55e-242)
		tmp = t_2;
	elseif (x <= 5.5e-17)
		tmp = Float64(y * 5.0);
	elseif ((x <= 1.9e+70) || !(x <= 2e+85))
		tmp = t_1;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * (y + z));
	t_2 = 2.0 * (x * z);
	tmp = 0.0;
	if (x <= -270000000000.0)
		tmp = t_1;
	elseif (x <= -6.3e-89)
		tmp = x * t;
	elseif (x <= -2.1e-246)
		tmp = y * 5.0;
	elseif (x <= -2e-246)
		tmp = t_2;
	elseif (x <= 3.5e-242)
		tmp = y * 5.0;
	elseif (x <= 3.55e-242)
		tmp = t_2;
	elseif (x <= 5.5e-17)
		tmp = y * 5.0;
	elseif ((x <= 1.9e+70) || ~((x <= 2e+85)))
		tmp = t_1;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -270000000000.0], t$95$1, If[LessEqual[x, -6.3e-89], N[(x * t), $MachinePrecision], If[LessEqual[x, -2.1e-246], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, -2e-246], t$95$2, If[LessEqual[x, 3.5e-242], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3.55e-242], t$95$2, If[LessEqual[x, 5.5e-17], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.9e+70], N[Not[LessEqual[x, 2e+85]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 1.9 \cdot 10^{+70} \lor \neg \left(x \leq 2 \cdot 10^{+85}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.7e11 or 5.50000000000000001e-17 < x < 1.8999999999999999e70 or 2e85 < 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 y around 0 100.0%

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

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} + y \cdot 5 \]
      2. distribute-lft-out76.4%

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

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

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

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

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

    if -2.7e11 < x < -6.2999999999999996e-89 or 1.8999999999999999e70 < x < 2e85

    1. Initial program 99.9%

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

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

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

    if -6.2999999999999996e-89 < x < -2.09999999999999995e-246 or -1.99999999999999991e-246 < x < 3.4999999999999999e-242 or 3.54999999999999981e-242 < x < 5.50000000000000001e-17

    1. Initial program 100.0%

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

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

    if -2.09999999999999995e-246 < x < -1.99999999999999991e-246 or 3.4999999999999999e-242 < x < 3.54999999999999981e-242

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -270000000000:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-246}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-242}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+70} \lor \neg \left(x \leq 2 \cdot 10^{+85}\right):\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 65.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ t_2 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -4.8 \cdot 10^{+141}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{+123}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -8 \cdot 10^{+24}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-40}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+73}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.7 \cdot 10^{+137}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* z 2.0)))) (t_2 (* 2.0 (* x (+ y z)))))
   (if (<= x -4.8e+141)
     t_2
     (if (<= x -8.6e+123)
       t_1
       (if (<= x -8e+24)
         t_2
         (if (<= x -3.8e-40)
           t_1
           (if (<= x 1.05e-17)
             (* y 5.0)
             (if (<= x 6.5e+47)
               t_1
               (if (<= x 4.4e+73)
                 t_2
                 (if (<= x 3.15e+122)
                   t_1
                   (if (<= x 6.7e+137) t_2 (* x (+ t (* y 2.0))))))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double tmp;
	if (x <= -4.8e+141) {
		tmp = t_2;
	} else if (x <= -8.6e+123) {
		tmp = t_1;
	} else if (x <= -8e+24) {
		tmp = t_2;
	} else if (x <= -3.8e-40) {
		tmp = t_1;
	} else if (x <= 1.05e-17) {
		tmp = y * 5.0;
	} else if (x <= 6.5e+47) {
		tmp = t_1;
	} else if (x <= 4.4e+73) {
		tmp = t_2;
	} else if (x <= 3.15e+122) {
		tmp = t_1;
	} else if (x <= 6.7e+137) {
		tmp = t_2;
	} else {
		tmp = x * (t + (y * 2.0));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (z * 2.0d0))
    t_2 = 2.0d0 * (x * (y + z))
    if (x <= (-4.8d+141)) then
        tmp = t_2
    else if (x <= (-8.6d+123)) then
        tmp = t_1
    else if (x <= (-8d+24)) then
        tmp = t_2
    else if (x <= (-3.8d-40)) then
        tmp = t_1
    else if (x <= 1.05d-17) then
        tmp = y * 5.0d0
    else if (x <= 6.5d+47) then
        tmp = t_1
    else if (x <= 4.4d+73) then
        tmp = t_2
    else if (x <= 3.15d+122) then
        tmp = t_1
    else if (x <= 6.7d+137) then
        tmp = t_2
    else
        tmp = x * (t + (y * 2.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double tmp;
	if (x <= -4.8e+141) {
		tmp = t_2;
	} else if (x <= -8.6e+123) {
		tmp = t_1;
	} else if (x <= -8e+24) {
		tmp = t_2;
	} else if (x <= -3.8e-40) {
		tmp = t_1;
	} else if (x <= 1.05e-17) {
		tmp = y * 5.0;
	} else if (x <= 6.5e+47) {
		tmp = t_1;
	} else if (x <= 4.4e+73) {
		tmp = t_2;
	} else if (x <= 3.15e+122) {
		tmp = t_1;
	} else if (x <= 6.7e+137) {
		tmp = t_2;
	} else {
		tmp = x * (t + (y * 2.0));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (z * 2.0))
	t_2 = 2.0 * (x * (y + z))
	tmp = 0
	if x <= -4.8e+141:
		tmp = t_2
	elif x <= -8.6e+123:
		tmp = t_1
	elif x <= -8e+24:
		tmp = t_2
	elif x <= -3.8e-40:
		tmp = t_1
	elif x <= 1.05e-17:
		tmp = y * 5.0
	elif x <= 6.5e+47:
		tmp = t_1
	elif x <= 4.4e+73:
		tmp = t_2
	elif x <= 3.15e+122:
		tmp = t_1
	elif x <= 6.7e+137:
		tmp = t_2
	else:
		tmp = x * (t + (y * 2.0))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(z * 2.0)))
	t_2 = Float64(2.0 * Float64(x * Float64(y + z)))
	tmp = 0.0
	if (x <= -4.8e+141)
		tmp = t_2;
	elseif (x <= -8.6e+123)
		tmp = t_1;
	elseif (x <= -8e+24)
		tmp = t_2;
	elseif (x <= -3.8e-40)
		tmp = t_1;
	elseif (x <= 1.05e-17)
		tmp = Float64(y * 5.0);
	elseif (x <= 6.5e+47)
		tmp = t_1;
	elseif (x <= 4.4e+73)
		tmp = t_2;
	elseif (x <= 3.15e+122)
		tmp = t_1;
	elseif (x <= 6.7e+137)
		tmp = t_2;
	else
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (z * 2.0));
	t_2 = 2.0 * (x * (y + z));
	tmp = 0.0;
	if (x <= -4.8e+141)
		tmp = t_2;
	elseif (x <= -8.6e+123)
		tmp = t_1;
	elseif (x <= -8e+24)
		tmp = t_2;
	elseif (x <= -3.8e-40)
		tmp = t_1;
	elseif (x <= 1.05e-17)
		tmp = y * 5.0;
	elseif (x <= 6.5e+47)
		tmp = t_1;
	elseif (x <= 4.4e+73)
		tmp = t_2;
	elseif (x <= 3.15e+122)
		tmp = t_1;
	elseif (x <= 6.7e+137)
		tmp = t_2;
	else
		tmp = x * (t + (y * 2.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.8e+141], t$95$2, If[LessEqual[x, -8.6e+123], t$95$1, If[LessEqual[x, -8e+24], t$95$2, If[LessEqual[x, -3.8e-40], t$95$1, If[LessEqual[x, 1.05e-17], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 6.5e+47], t$95$1, If[LessEqual[x, 4.4e+73], t$95$2, If[LessEqual[x, 3.15e+122], t$95$1, If[LessEqual[x, 6.7e+137], t$95$2, N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq -8 \cdot 10^{+24}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -3.8 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;x \leq 4.4 \cdot 10^{+73}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 3.15 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.7 \cdot 10^{+137}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.79999999999999995e141 or -8.59999999999999972e123 < x < -7.9999999999999999e24 or 6.49999999999999988e47 < x < 4.4e73 or 3.1500000000000001e122 < x < 6.6999999999999999e137

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -4.79999999999999995e141 < x < -8.59999999999999972e123 or -7.9999999999999999e24 < x < -3.7999999999999999e-40 or 1.04999999999999996e-17 < x < 6.49999999999999988e47 or 4.4e73 < x < 3.1500000000000001e122

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

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

    if -3.7999999999999999e-40 < x < 1.04999999999999996e-17

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

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

    if 6.6999999999999999e137 < 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 y around 0 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+141}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{+123}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq -8 \cdot 10^{+24}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-40}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+47}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+73}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{+122}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 6.7 \cdot 10^{+137}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 48.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ t_2 := x \cdot \left(y \cdot 2\right)\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{+65}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+37}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-40}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 10500000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.82 \cdot 10^{+46}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+82}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+83}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+127}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))) (t_2 (* x (* y 2.0))))
   (if (<= x -2.3e+65)
     t_1
     (if (<= x -3.6e+37)
       t_2
       (if (<= x -3.2e-40)
         (* x t)
         (if (<= x 5.8e-17)
           (* y 5.0)
           (if (<= x 10500000.0)
             t_1
             (if (<= x 1.82e+46)
               (* x t)
               (if (<= x 5e+82)
                 t_2
                 (if (<= x 8.2e+83)
                   (* x t)
                   (if (<= x 8.4e+127) t_1 t_2)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double t_2 = x * (y * 2.0);
	double tmp;
	if (x <= -2.3e+65) {
		tmp = t_1;
	} else if (x <= -3.6e+37) {
		tmp = t_2;
	} else if (x <= -3.2e-40) {
		tmp = x * t;
	} else if (x <= 5.8e-17) {
		tmp = y * 5.0;
	} else if (x <= 10500000.0) {
		tmp = t_1;
	} else if (x <= 1.82e+46) {
		tmp = x * t;
	} else if (x <= 5e+82) {
		tmp = t_2;
	} else if (x <= 8.2e+83) {
		tmp = x * t;
	} else if (x <= 8.4e+127) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    t_2 = x * (y * 2.0d0)
    if (x <= (-2.3d+65)) then
        tmp = t_1
    else if (x <= (-3.6d+37)) then
        tmp = t_2
    else if (x <= (-3.2d-40)) then
        tmp = x * t
    else if (x <= 5.8d-17) then
        tmp = y * 5.0d0
    else if (x <= 10500000.0d0) then
        tmp = t_1
    else if (x <= 1.82d+46) then
        tmp = x * t
    else if (x <= 5d+82) then
        tmp = t_2
    else if (x <= 8.2d+83) then
        tmp = x * t
    else if (x <= 8.4d+127) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double t_2 = x * (y * 2.0);
	double tmp;
	if (x <= -2.3e+65) {
		tmp = t_1;
	} else if (x <= -3.6e+37) {
		tmp = t_2;
	} else if (x <= -3.2e-40) {
		tmp = x * t;
	} else if (x <= 5.8e-17) {
		tmp = y * 5.0;
	} else if (x <= 10500000.0) {
		tmp = t_1;
	} else if (x <= 1.82e+46) {
		tmp = x * t;
	} else if (x <= 5e+82) {
		tmp = t_2;
	} else if (x <= 8.2e+83) {
		tmp = x * t;
	} else if (x <= 8.4e+127) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	t_2 = x * (y * 2.0)
	tmp = 0
	if x <= -2.3e+65:
		tmp = t_1
	elif x <= -3.6e+37:
		tmp = t_2
	elif x <= -3.2e-40:
		tmp = x * t
	elif x <= 5.8e-17:
		tmp = y * 5.0
	elif x <= 10500000.0:
		tmp = t_1
	elif x <= 1.82e+46:
		tmp = x * t
	elif x <= 5e+82:
		tmp = t_2
	elif x <= 8.2e+83:
		tmp = x * t
	elif x <= 8.4e+127:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	t_2 = Float64(x * Float64(y * 2.0))
	tmp = 0.0
	if (x <= -2.3e+65)
		tmp = t_1;
	elseif (x <= -3.6e+37)
		tmp = t_2;
	elseif (x <= -3.2e-40)
		tmp = Float64(x * t);
	elseif (x <= 5.8e-17)
		tmp = Float64(y * 5.0);
	elseif (x <= 10500000.0)
		tmp = t_1;
	elseif (x <= 1.82e+46)
		tmp = Float64(x * t);
	elseif (x <= 5e+82)
		tmp = t_2;
	elseif (x <= 8.2e+83)
		tmp = Float64(x * t);
	elseif (x <= 8.4e+127)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	t_2 = x * (y * 2.0);
	tmp = 0.0;
	if (x <= -2.3e+65)
		tmp = t_1;
	elseif (x <= -3.6e+37)
		tmp = t_2;
	elseif (x <= -3.2e-40)
		tmp = x * t;
	elseif (x <= 5.8e-17)
		tmp = y * 5.0;
	elseif (x <= 10500000.0)
		tmp = t_1;
	elseif (x <= 1.82e+46)
		tmp = x * t;
	elseif (x <= 5e+82)
		tmp = t_2;
	elseif (x <= 8.2e+83)
		tmp = x * t;
	elseif (x <= 8.4e+127)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.3e+65], t$95$1, If[LessEqual[x, -3.6e+37], t$95$2, If[LessEqual[x, -3.2e-40], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.8e-17], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 10500000.0], t$95$1, If[LessEqual[x, 1.82e+46], N[(x * t), $MachinePrecision], If[LessEqual[x, 5e+82], t$95$2, If[LessEqual[x, 8.2e+83], N[(x * t), $MachinePrecision], If[LessEqual[x, 8.4e+127], t$95$1, t$95$2]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -3.6 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -3.2 \cdot 10^{-40}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 10500000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.82 \cdot 10^{+46}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 5 \cdot 10^{+82}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{+83}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 8.4 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.3e65 or 5.8000000000000006e-17 < x < 1.05e7 or 8.2000000000000002e83 < x < 8.39999999999999967e127

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

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

    if -2.3e65 < x < -3.59999999999999998e37 or 1.81999999999999989e46 < x < 5.00000000000000015e82 or 8.39999999999999967e127 < 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 y around 0 100.0%

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

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} + y \cdot 5 \]
      2. distribute-lft-out76.3%

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

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

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

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

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

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

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

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

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

    if -3.59999999999999998e37 < x < -3.20000000000000002e-40 or 1.05e7 < x < 1.81999999999999989e46 or 5.00000000000000015e82 < x < 8.2000000000000002e83

    1. Initial program 99.9%

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

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

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

    if -3.20000000000000002e-40 < x < 5.8000000000000006e-17

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+65}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+37}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-40}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-17}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 10500000:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 1.82 \cdot 10^{+46}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+82}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+83}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+127}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ t_2 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -4.6 \cdot 10^{+141}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+123}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{+33}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+142}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+278}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+305}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* z 2.0)))) (t_2 (* 2.0 (* x (+ y z)))))
   (if (<= x -4.6e+141)
     t_2
     (if (<= x -6.2e+123)
       t_1
       (if (<= x -7.8e+33)
         t_2
         (if (<= x 1.85e-16)
           (+ (* y 5.0) (* x t))
           (if (<= x 1.6e+122)
             t_1
             (if (<= x 2.2e+142)
               t_2
               (if (<= x 4.8e+278)
                 (* x (+ t (* y 2.0)))
                 (if (<= x 2.6e+305) t_2 (* x t)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double tmp;
	if (x <= -4.6e+141) {
		tmp = t_2;
	} else if (x <= -6.2e+123) {
		tmp = t_1;
	} else if (x <= -7.8e+33) {
		tmp = t_2;
	} else if (x <= 1.85e-16) {
		tmp = (y * 5.0) + (x * t);
	} else if (x <= 1.6e+122) {
		tmp = t_1;
	} else if (x <= 2.2e+142) {
		tmp = t_2;
	} else if (x <= 4.8e+278) {
		tmp = x * (t + (y * 2.0));
	} else if (x <= 2.6e+305) {
		tmp = t_2;
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + (z * 2.0d0))
    t_2 = 2.0d0 * (x * (y + z))
    if (x <= (-4.6d+141)) then
        tmp = t_2
    else if (x <= (-6.2d+123)) then
        tmp = t_1
    else if (x <= (-7.8d+33)) then
        tmp = t_2
    else if (x <= 1.85d-16) then
        tmp = (y * 5.0d0) + (x * t)
    else if (x <= 1.6d+122) then
        tmp = t_1
    else if (x <= 2.2d+142) then
        tmp = t_2
    else if (x <= 4.8d+278) then
        tmp = x * (t + (y * 2.0d0))
    else if (x <= 2.6d+305) then
        tmp = t_2
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double tmp;
	if (x <= -4.6e+141) {
		tmp = t_2;
	} else if (x <= -6.2e+123) {
		tmp = t_1;
	} else if (x <= -7.8e+33) {
		tmp = t_2;
	} else if (x <= 1.85e-16) {
		tmp = (y * 5.0) + (x * t);
	} else if (x <= 1.6e+122) {
		tmp = t_1;
	} else if (x <= 2.2e+142) {
		tmp = t_2;
	} else if (x <= 4.8e+278) {
		tmp = x * (t + (y * 2.0));
	} else if (x <= 2.6e+305) {
		tmp = t_2;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (z * 2.0))
	t_2 = 2.0 * (x * (y + z))
	tmp = 0
	if x <= -4.6e+141:
		tmp = t_2
	elif x <= -6.2e+123:
		tmp = t_1
	elif x <= -7.8e+33:
		tmp = t_2
	elif x <= 1.85e-16:
		tmp = (y * 5.0) + (x * t)
	elif x <= 1.6e+122:
		tmp = t_1
	elif x <= 2.2e+142:
		tmp = t_2
	elif x <= 4.8e+278:
		tmp = x * (t + (y * 2.0))
	elif x <= 2.6e+305:
		tmp = t_2
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(z * 2.0)))
	t_2 = Float64(2.0 * Float64(x * Float64(y + z)))
	tmp = 0.0
	if (x <= -4.6e+141)
		tmp = t_2;
	elseif (x <= -6.2e+123)
		tmp = t_1;
	elseif (x <= -7.8e+33)
		tmp = t_2;
	elseif (x <= 1.85e-16)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	elseif (x <= 1.6e+122)
		tmp = t_1;
	elseif (x <= 2.2e+142)
		tmp = t_2;
	elseif (x <= 4.8e+278)
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	elseif (x <= 2.6e+305)
		tmp = t_2;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (z * 2.0));
	t_2 = 2.0 * (x * (y + z));
	tmp = 0.0;
	if (x <= -4.6e+141)
		tmp = t_2;
	elseif (x <= -6.2e+123)
		tmp = t_1;
	elseif (x <= -7.8e+33)
		tmp = t_2;
	elseif (x <= 1.85e-16)
		tmp = (y * 5.0) + (x * t);
	elseif (x <= 1.6e+122)
		tmp = t_1;
	elseif (x <= 2.2e+142)
		tmp = t_2;
	elseif (x <= 4.8e+278)
		tmp = x * (t + (y * 2.0));
	elseif (x <= 2.6e+305)
		tmp = t_2;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.6e+141], t$95$2, If[LessEqual[x, -6.2e+123], t$95$1, If[LessEqual[x, -7.8e+33], t$95$2, If[LessEqual[x, 1.85e-16], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e+122], t$95$1, If[LessEqual[x, 2.2e+142], t$95$2, If[LessEqual[x, 4.8e+278], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+305], t$95$2, N[(x * t), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq -7.8 \cdot 10^{+33}:\\
\;\;\;\;t\_2\\

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

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

\mathbf{elif}\;x \leq 2.2 \cdot 10^{+142}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 2.6 \cdot 10^{+305}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -4.6000000000000003e141 or -6.20000000000000013e123 < x < -7.8000000000000004e33 or 1.60000000000000006e122 < x < 2.19999999999999987e142 or 4.7999999999999997e278 < x < 2.59999999999999984e305

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} + y \cdot 5 \]
      2. distribute-lft-out87.4%

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

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

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

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

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

    if -4.6000000000000003e141 < x < -6.20000000000000013e123 or 1.85e-16 < x < 1.60000000000000006e122

    1. Initial program 100.0%

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

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

    if -7.8000000000000004e33 < x < 1.85e-16

    1. Initial program 99.9%

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

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

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

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

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

    if 2.19999999999999987e142 < x < 4.7999999999999997e278

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if 2.59999999999999984e305 < 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 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{+141}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+123}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{+33}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+122}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{+142}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+278}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+305}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 63.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ t_2 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ t_3 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -6800000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-246}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-242}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3200000000:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* y 2.0))))
        (t_2 (* 2.0 (* x (+ y z))))
        (t_3 (* 2.0 (* x z))))
   (if (<= x -6800000000000.0)
     t_2
     (if (<= x -6.3e-89)
       t_1
       (if (<= x -2.1e-246)
         (* y 5.0)
         (if (<= x -2e-246)
           t_3
           (if (<= x 3.5e-242)
             (* y 5.0)
             (if (<= x 3.55e-242)
               t_3
               (if (<= x 8.5e-16)
                 (* y 5.0)
                 (if (<= x 3200000000.0) t_2 t_1))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double t_3 = 2.0 * (x * z);
	double tmp;
	if (x <= -6800000000000.0) {
		tmp = t_2;
	} else if (x <= -6.3e-89) {
		tmp = t_1;
	} else if (x <= -2.1e-246) {
		tmp = y * 5.0;
	} else if (x <= -2e-246) {
		tmp = t_3;
	} else if (x <= 3.5e-242) {
		tmp = y * 5.0;
	} else if (x <= 3.55e-242) {
		tmp = t_3;
	} else if (x <= 8.5e-16) {
		tmp = y * 5.0;
	} else if (x <= 3200000000.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = x * (t + (y * 2.0d0))
    t_2 = 2.0d0 * (x * (y + z))
    t_3 = 2.0d0 * (x * z)
    if (x <= (-6800000000000.0d0)) then
        tmp = t_2
    else if (x <= (-6.3d-89)) then
        tmp = t_1
    else if (x <= (-2.1d-246)) then
        tmp = y * 5.0d0
    else if (x <= (-2d-246)) then
        tmp = t_3
    else if (x <= 3.5d-242) then
        tmp = y * 5.0d0
    else if (x <= 3.55d-242) then
        tmp = t_3
    else if (x <= 8.5d-16) then
        tmp = y * 5.0d0
    else if (x <= 3200000000.0d0) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double t_2 = 2.0 * (x * (y + z));
	double t_3 = 2.0 * (x * z);
	double tmp;
	if (x <= -6800000000000.0) {
		tmp = t_2;
	} else if (x <= -6.3e-89) {
		tmp = t_1;
	} else if (x <= -2.1e-246) {
		tmp = y * 5.0;
	} else if (x <= -2e-246) {
		tmp = t_3;
	} else if (x <= 3.5e-242) {
		tmp = y * 5.0;
	} else if (x <= 3.55e-242) {
		tmp = t_3;
	} else if (x <= 8.5e-16) {
		tmp = y * 5.0;
	} else if (x <= 3200000000.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (y * 2.0))
	t_2 = 2.0 * (x * (y + z))
	t_3 = 2.0 * (x * z)
	tmp = 0
	if x <= -6800000000000.0:
		tmp = t_2
	elif x <= -6.3e-89:
		tmp = t_1
	elif x <= -2.1e-246:
		tmp = y * 5.0
	elif x <= -2e-246:
		tmp = t_3
	elif x <= 3.5e-242:
		tmp = y * 5.0
	elif x <= 3.55e-242:
		tmp = t_3
	elif x <= 8.5e-16:
		tmp = y * 5.0
	elif x <= 3200000000.0:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(y * 2.0)))
	t_2 = Float64(2.0 * Float64(x * Float64(y + z)))
	t_3 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (x <= -6800000000000.0)
		tmp = t_2;
	elseif (x <= -6.3e-89)
		tmp = t_1;
	elseif (x <= -2.1e-246)
		tmp = Float64(y * 5.0);
	elseif (x <= -2e-246)
		tmp = t_3;
	elseif (x <= 3.5e-242)
		tmp = Float64(y * 5.0);
	elseif (x <= 3.55e-242)
		tmp = t_3;
	elseif (x <= 8.5e-16)
		tmp = Float64(y * 5.0);
	elseif (x <= 3200000000.0)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (y * 2.0));
	t_2 = 2.0 * (x * (y + z));
	t_3 = 2.0 * (x * z);
	tmp = 0.0;
	if (x <= -6800000000000.0)
		tmp = t_2;
	elseif (x <= -6.3e-89)
		tmp = t_1;
	elseif (x <= -2.1e-246)
		tmp = y * 5.0;
	elseif (x <= -2e-246)
		tmp = t_3;
	elseif (x <= 3.5e-242)
		tmp = y * 5.0;
	elseif (x <= 3.55e-242)
		tmp = t_3;
	elseif (x <= 8.5e-16)
		tmp = y * 5.0;
	elseif (x <= 3200000000.0)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6800000000000.0], t$95$2, If[LessEqual[x, -6.3e-89], t$95$1, If[LessEqual[x, -2.1e-246], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, -2e-246], t$95$3, If[LessEqual[x, 3.5e-242], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3.55e-242], t$95$3, If[LessEqual[x, 8.5e-16], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3200000000.0], t$95$2, t$95$1]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;x \leq 3200000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.8e12 or 8.5000000000000001e-16 < x < 3.2e9

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} + y \cdot 5 \]
      2. distribute-lft-out81.9%

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

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

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

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

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

    if -6.8e12 < x < -6.2999999999999996e-89 or 3.2e9 < 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 y around 0 100.0%

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
    6. Simplified91.4%

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

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

    if -6.2999999999999996e-89 < x < -2.09999999999999995e-246 or -1.99999999999999991e-246 < x < 3.4999999999999999e-242 or 3.54999999999999981e-242 < x < 8.5000000000000001e-16

    1. Initial program 100.0%

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

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

    if -2.09999999999999995e-246 < x < -1.99999999999999991e-246 or 3.4999999999999999e-242 < x < 3.54999999999999981e-242

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6800000000000:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-246}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-246}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-242}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.55 \cdot 10^{-242}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3200000000:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 77.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -1.8 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.24 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 4.85 \cdot 10^{+58}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+69} \lor \neg \left(y \leq 2 \cdot 10^{+69}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -1.8e+60)
     t_1
     (if (<= y -3.4e+15)
       (* x (+ t (* y 2.0)))
       (if (<= y -1.24e-26)
         t_1
         (if (<= y 4.85e+58)
           (* x (+ t (* z 2.0)))
           (if (or (<= y 1.95e+69) (not (<= y 2e+69))) t_1 (* x t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.8e+60) {
		tmp = t_1;
	} else if (y <= -3.4e+15) {
		tmp = x * (t + (y * 2.0));
	} else if (y <= -1.24e-26) {
		tmp = t_1;
	} else if (y <= 4.85e+58) {
		tmp = x * (t + (z * 2.0));
	} else if ((y <= 1.95e+69) || !(y <= 2e+69)) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-1.8d+60)) then
        tmp = t_1
    else if (y <= (-3.4d+15)) then
        tmp = x * (t + (y * 2.0d0))
    else if (y <= (-1.24d-26)) then
        tmp = t_1
    else if (y <= 4.85d+58) then
        tmp = x * (t + (z * 2.0d0))
    else if ((y <= 1.95d+69) .or. (.not. (y <= 2d+69))) then
        tmp = t_1
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -1.8e+60) {
		tmp = t_1;
	} else if (y <= -3.4e+15) {
		tmp = x * (t + (y * 2.0));
	} else if (y <= -1.24e-26) {
		tmp = t_1;
	} else if (y <= 4.85e+58) {
		tmp = x * (t + (z * 2.0));
	} else if ((y <= 1.95e+69) || !(y <= 2e+69)) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -1.8e+60:
		tmp = t_1
	elif y <= -3.4e+15:
		tmp = x * (t + (y * 2.0))
	elif y <= -1.24e-26:
		tmp = t_1
	elif y <= 4.85e+58:
		tmp = x * (t + (z * 2.0))
	elif (y <= 1.95e+69) or not (y <= 2e+69):
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -1.8e+60)
		tmp = t_1;
	elseif (y <= -3.4e+15)
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	elseif (y <= -1.24e-26)
		tmp = t_1;
	elseif (y <= 4.85e+58)
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	elseif ((y <= 1.95e+69) || !(y <= 2e+69))
		tmp = t_1;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -1.8e+60)
		tmp = t_1;
	elseif (y <= -3.4e+15)
		tmp = x * (t + (y * 2.0));
	elseif (y <= -1.24e-26)
		tmp = t_1;
	elseif (y <= 4.85e+58)
		tmp = x * (t + (z * 2.0));
	elseif ((y <= 1.95e+69) || ~((y <= 2e+69)))
		tmp = t_1;
	else
		tmp = x * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+60], t$95$1, If[LessEqual[y, -3.4e+15], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.24e-26], t$95$1, If[LessEqual[y, 4.85e+58], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.95e+69], N[Not[LessEqual[y, 2e+69]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -1.24 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 1.95 \cdot 10^{+69} \lor \neg \left(y \leq 2 \cdot 10^{+69}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.79999999999999984e60 or -3.4e15 < y < -1.2399999999999999e-26 or 4.8499999999999998e58 < y < 1.94999999999999995e69 or 2.0000000000000001e69 < 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 80.5%

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

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

    if -1.79999999999999984e60 < y < -3.4e15

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.2399999999999999e-26 < y < 4.8499999999999998e58

    1. Initial program 100.0%

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

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

    if 1.94999999999999995e69 < y < 2.0000000000000001e69

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+60}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.24 \cdot 10^{-26}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 4.85 \cdot 10^{+58}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+69} \lor \neg \left(y \leq 2 \cdot 10^{+69}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 88.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x \leq -1.2 \cdot 10^{-231}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 1.08 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.1499999999999998e-71 or 1.08e-16 < 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 97.0%

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

    if -2.1499999999999998e-71 < x < -1.19999999999999996e-231 or -5.19999999999999979e-288 < x < 1.08e-16

    1. Initial program 99.9%

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

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

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

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

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

    if -1.19999999999999996e-231 < x < -5.19999999999999979e-288

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-231}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-288}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(z \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 46.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 100000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.1e13 or 2.1000000000000001e-16 < x < 1e8

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

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

    if -2.1e13 < x < -6.2999999999999996e-89 or 1e8 < 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 42.4%

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

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

    if -6.2999999999999996e-89 < x < 2.1000000000000001e-16

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -21000000000000:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -6.3 \cdot 10^{-89}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-16}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 100000000:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 98.3% accurate, 0.6× speedup?

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

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

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

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


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

    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)} \]

    if -7.8000000000000004e33 < x < 3.20000000000000017e-100

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

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

    if 3.20000000000000017e-100 < 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 99.9%

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

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

Alternative 11: 97.2% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.8000000000000004e33 or 4.09999999999999973e-51 < 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 97.3%

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

    if -7.8000000000000004e33 < x < 4.09999999999999973e-51

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

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

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

Alternative 12: 88.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-72} \lor \neg \left(x \leq 1.75 \cdot 10^{-51}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.5999999999999996e-72 or 1.7499999999999999e-51 < 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 94.7%

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

    if -5.5999999999999996e-72 < x < 1.7499999999999999e-51

    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. Simplified90.5%

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

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

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

Alternative 13: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 14: 46.0% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.00000000000000007e-17 or 3.20000000000000017e-100 < 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 33.9%

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

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

    if -1.00000000000000007e-17 < x < 3.20000000000000017e-100

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

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

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

Alternative 15: 30.1% 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 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 x around 0 33.5%

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

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

Reproduce

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