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

Percentage Accurate: 99.9% → 99.9%
Time: 10.4s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

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

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

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

      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + 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. Final simplification100.0%

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

Alternative 2: 99.9% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, t + 2 \cdot \left(y + z\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-def100.0%

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

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

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

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

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

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

Alternative 3: 64.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -240000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-163}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 2.55 \cdot 10^{+101} \lor \neg \left(x \leq 8.5 \cdot 10^{+186}\right) \land x \leq 8.5 \cdot 10^{+304}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* y 2.0)))))
   (if (<= x -240000000000.0)
     t_1
     (if (<= x -1.4e-163)
       (* x (+ t (* z 2.0)))
       (if (<= x 8e-24)
         (* y 5.0)
         (if (or (<= x 2.55e+101) (and (not (<= x 8.5e+186)) (<= x 8.5e+304)))
           (* x (* 2.0 (+ y z)))
           t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -240000000000.0) {
		tmp = t_1;
	} else if (x <= -1.4e-163) {
		tmp = x * (t + (z * 2.0));
	} else if (x <= 8e-24) {
		tmp = y * 5.0;
	} else if ((x <= 2.55e+101) || (!(x <= 8.5e+186) && (x <= 8.5e+304))) {
		tmp = x * (2.0 * (y + z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (t + (y * 2.0d0))
    if (x <= (-240000000000.0d0)) then
        tmp = t_1
    else if (x <= (-1.4d-163)) then
        tmp = x * (t + (z * 2.0d0))
    else if (x <= 8d-24) then
        tmp = y * 5.0d0
    else if ((x <= 2.55d+101) .or. (.not. (x <= 8.5d+186)) .and. (x <= 8.5d+304)) then
        tmp = x * (2.0d0 * (y + z))
    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 tmp;
	if (x <= -240000000000.0) {
		tmp = t_1;
	} else if (x <= -1.4e-163) {
		tmp = x * (t + (z * 2.0));
	} else if (x <= 8e-24) {
		tmp = y * 5.0;
	} else if ((x <= 2.55e+101) || (!(x <= 8.5e+186) && (x <= 8.5e+304))) {
		tmp = x * (2.0 * (y + z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (y * 2.0))
	tmp = 0
	if x <= -240000000000.0:
		tmp = t_1
	elif x <= -1.4e-163:
		tmp = x * (t + (z * 2.0))
	elif x <= 8e-24:
		tmp = y * 5.0
	elif (x <= 2.55e+101) or (not (x <= 8.5e+186) and (x <= 8.5e+304)):
		tmp = x * (2.0 * (y + z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(y * 2.0)))
	tmp = 0.0
	if (x <= -240000000000.0)
		tmp = t_1;
	elseif (x <= -1.4e-163)
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	elseif (x <= 8e-24)
		tmp = Float64(y * 5.0);
	elseif ((x <= 2.55e+101) || (!(x <= 8.5e+186) && (x <= 8.5e+304)))
		tmp = Float64(x * Float64(2.0 * Float64(y + z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (y * 2.0));
	tmp = 0.0;
	if (x <= -240000000000.0)
		tmp = t_1;
	elseif (x <= -1.4e-163)
		tmp = x * (t + (z * 2.0));
	elseif (x <= 8e-24)
		tmp = y * 5.0;
	elseif ((x <= 2.55e+101) || (~((x <= 8.5e+186)) && (x <= 8.5e+304)))
		tmp = x * (2.0 * (y + z));
	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]}, If[LessEqual[x, -240000000000.0], t$95$1, If[LessEqual[x, -1.4e-163], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e-24], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 2.55e+101], And[N[Not[LessEqual[x, 8.5e+186]], $MachinePrecision], LessEqual[x, 8.5e+304]]], N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;x \leq 2.55 \cdot 10^{+101} \lor \neg \left(x \leq 8.5 \cdot 10^{+186}\right) \land x \leq 8.5 \cdot 10^{+304}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.4e11 or 2.54999999999999997e101 < x < 8.4999999999999999e186 or 8.5000000000000005e304 < 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 96.3%

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

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

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

    if -2.4e11 < x < -1.4e-163

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

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

    if -1.4e-163 < x < 7.99999999999999939e-24

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

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

    if 7.99999999999999939e-24 < x < 2.54999999999999997e101 or 8.4999999999999999e186 < x < 8.5000000000000005e304

    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 0 85.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -240000000000:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-163}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 2.55 \cdot 10^{+101} \lor \neg \left(x \leq 8.5 \cdot 10^{+186}\right) \land x \leq 8.5 \cdot 10^{+304}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 63.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -200:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-27}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+101} \lor \neg \left(x \leq 1.2 \cdot 10^{+184}\right) \land x \leq 1.75 \cdot 10^{+305}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* y 2.0)))))
   (if (<= x -200.0)
     t_1
     (if (<= x 5.6e-27)
       (* y 5.0)
       (if (or (<= x 1.15e+101) (and (not (<= x 1.2e+184)) (<= x 1.75e+305)))
         (* x (* 2.0 (+ y z)))
         t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -200.0) {
		tmp = t_1;
	} else if (x <= 5.6e-27) {
		tmp = y * 5.0;
	} else if ((x <= 1.15e+101) || (!(x <= 1.2e+184) && (x <= 1.75e+305))) {
		tmp = x * (2.0 * (y + z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (t + (y * 2.0d0))
    if (x <= (-200.0d0)) then
        tmp = t_1
    else if (x <= 5.6d-27) then
        tmp = y * 5.0d0
    else if ((x <= 1.15d+101) .or. (.not. (x <= 1.2d+184)) .and. (x <= 1.75d+305)) then
        tmp = x * (2.0d0 * (y + z))
    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 tmp;
	if (x <= -200.0) {
		tmp = t_1;
	} else if (x <= 5.6e-27) {
		tmp = y * 5.0;
	} else if ((x <= 1.15e+101) || (!(x <= 1.2e+184) && (x <= 1.75e+305))) {
		tmp = x * (2.0 * (y + z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (y * 2.0))
	tmp = 0
	if x <= -200.0:
		tmp = t_1
	elif x <= 5.6e-27:
		tmp = y * 5.0
	elif (x <= 1.15e+101) or (not (x <= 1.2e+184) and (x <= 1.75e+305)):
		tmp = x * (2.0 * (y + z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(y * 2.0)))
	tmp = 0.0
	if (x <= -200.0)
		tmp = t_1;
	elseif (x <= 5.6e-27)
		tmp = Float64(y * 5.0);
	elseif ((x <= 1.15e+101) || (!(x <= 1.2e+184) && (x <= 1.75e+305)))
		tmp = Float64(x * Float64(2.0 * Float64(y + z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (y * 2.0));
	tmp = 0.0;
	if (x <= -200.0)
		tmp = t_1;
	elseif (x <= 5.6e-27)
		tmp = y * 5.0;
	elseif ((x <= 1.15e+101) || (~((x <= 1.2e+184)) && (x <= 1.75e+305)))
		tmp = x * (2.0 * (y + z));
	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]}, If[LessEqual[x, -200.0], t$95$1, If[LessEqual[x, 5.6e-27], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.15e+101], And[N[Not[LessEqual[x, 1.2e+184]], $MachinePrecision], LessEqual[x, 1.75e+305]]], N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 1.15 \cdot 10^{+101} \lor \neg \left(x \leq 1.2 \cdot 10^{+184}\right) \land x \leq 1.75 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -200 or 1.1500000000000001e101 < x < 1.19999999999999998e184 or 1.75e305 < 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 96.3%

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

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

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

    if -200 < x < 5.5999999999999999e-27

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

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

    if 5.5999999999999999e-27 < x < 1.1500000000000001e101 or 1.19999999999999998e184 < x < 1.75e305

    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 0 85.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -200:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-27}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+101} \lor \neg \left(x \leq 1.2 \cdot 10^{+184}\right) \land x \leq 1.75 \cdot 10^{+305}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 59.9% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq -5.4 \cdot 10^{+101}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -1.8 \cdot 10^{-79} \lor \neg \left(x \leq 2.7 \cdot 10^{-25}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.5000000000000003e221 or -5.40000000000000012e101 < x < -1.8000000000000001e-79 or 2.70000000000000016e-25 < 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 0 79.0%

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

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

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

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

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

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

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

    if -5.5000000000000003e221 < x < -5.40000000000000012e101

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

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

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

    if -1.8000000000000001e-79 < x < 2.70000000000000016e-25

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+221}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{+101}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-79} \lor \neg \left(x \leq 2.7 \cdot 10^{-25}\right):\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot 5 + x \cdot t\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -4.3 \cdot 10^{+114}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -1.12 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{+62}:\\ \;\;\;\;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 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -4.3e+114)
     t_2
     (if (<= y -1.12e-7)
       t_1
       (if (<= y 2.2e-14)
         (* x (+ t (* z 2.0)))
         (if (<= y 7.6e+62) 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 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -4.3e+114) {
		tmp = t_2;
	} else if (y <= -1.12e-7) {
		tmp = t_1;
	} else if (y <= 2.2e-14) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 7.6e+62) {
		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 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-4.3d+114)) then
        tmp = t_2
    else if (y <= (-1.12d-7)) then
        tmp = t_1
    else if (y <= 2.2d-14) then
        tmp = x * (t + (z * 2.0d0))
    else if (y <= 7.6d+62) 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 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -4.3e+114) {
		tmp = t_2;
	} else if (y <= -1.12e-7) {
		tmp = t_1;
	} else if (y <= 2.2e-14) {
		tmp = x * (t + (z * 2.0));
	} else if (y <= 7.6e+62) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * 5.0) + (x * t)
	t_2 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -4.3e+114:
		tmp = t_2
	elif y <= -1.12e-7:
		tmp = t_1
	elif y <= 2.2e-14:
		tmp = x * (t + (z * 2.0))
	elif y <= 7.6e+62:
		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(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -4.3e+114)
		tmp = t_2;
	elseif (y <= -1.12e-7)
		tmp = t_1;
	elseif (y <= 2.2e-14)
		tmp = Float64(x * Float64(t + Float64(z * 2.0)));
	elseif (y <= 7.6e+62)
		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 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -4.3e+114)
		tmp = t_2;
	elseif (y <= -1.12e-7)
		tmp = t_1;
	elseif (y <= 2.2e-14)
		tmp = x * (t + (z * 2.0));
	elseif (y <= 7.6e+62)
		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[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e+114], t$95$2, If[LessEqual[y, -1.12e-7], t$95$1, If[LessEqual[y, 2.2e-14], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e+62], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.12 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y \leq 7.6 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.3000000000000001e114 or 7.59999999999999967e62 < 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 93.7%

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

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

    if -4.3000000000000001e114 < y < -1.12e-7 or 2.2000000000000001e-14 < y < 7.59999999999999967e62

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

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

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

    if -1.12e-7 < y < 2.2000000000000001e-14

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.3 \cdot 10^{+114}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.12 \cdot 10^{-7}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{+62}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 48.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq -200:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 1.95 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\

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


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

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

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

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

    if -5.2e101 < x < -200 or 1.95e101 < 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 \color{blue}{x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + 2 \cdot x\right)} \]
    4. Taylor expanded in z around 0 80.0%

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

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

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

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

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

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

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

    if -200 < x < 9.59999999999999986e-23

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

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

    if 9.59999999999999986e-23 < x < 1.95e101

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

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

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

Alternative 8: 84.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-56} \lor \neg \left(y \leq 5.5 \cdot 10^{-17}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.0000000000000001e-56 or 5.50000000000000001e-17 < 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 0 97.9%

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

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

    if -9.0000000000000001e-56 < y < 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. Step-by-step derivation
      1. fma-def100.0%

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

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

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

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

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

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

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

Alternative 9: 88.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1e32 or 6.5e13 < x

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)} \]
    4. 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 -1.1e32 < x < 6.5e13

    1. Initial program 99.9%

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

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

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

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

Alternative 10: 48.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -200:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 1.55 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -200 or 1.55e101 < 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 46.6%

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

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

    if -200 < x < 1.18e-24

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

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

    if 1.18e-24 < x < 1.55e101

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -200:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.18 \cdot 10^{-24}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{+101}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 88.0% accurate, 0.8× speedup?

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.45e-79 < x < 4.4999999999999998e-28

    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. Simplified77.7%

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

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+116} \lor \neg \left(y \leq 260000000\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.00000000000000002e116 or 2.6e8 < y

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

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

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

    if -1.00000000000000002e116 < y < 2.6e8

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

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

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

Alternative 13: 96.6% accurate, 1.0× speedup?

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

\\
x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\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. Add Preprocessing
  3. Taylor expanded in y around 0 98.8%

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

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

Alternative 14: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 15: 47.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -200 \lor \neg \left(x \leq 50000000000000\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -200 or 5e13 < 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.5%

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

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

    if -200 < x < 5e13

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -200 \lor \neg \left(x \leq 50000000000000\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 30.2% 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 29.1%

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

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

Reproduce

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