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

Percentage Accurate: 99.9% → 100.0%
Time: 7.7s
Alternatives: 15
Speedup: 1.2×

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: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
    4. *-un-lft-identity100.0%

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
    6. *-un-lft-identity100.0%

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
    8. *-un-lft-identity100.0%

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
    9. distribute-rgt-out100.0%

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

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

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

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

Alternative 2: 88.0% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;x \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;y \cdot 5 + x \cdot t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.89999999999999999e31 or 1.90000000000000006e-9 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

    if -3.89999999999999999e31 < x < 1.0399999999999999e-209

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

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

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

    if 1.0399999999999999e-209 < x < 1.90000000000000006e-9

    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. *-un-lft-identity99.9%

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

        \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right) + y \cdot 5 \]
      4. *-un-lft-identity99.9%

        \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right) + y \cdot 5 \]
      5. distribute-rgt-out99.9%

        \[\leadsto x \cdot \left(\color{blue}{\left(y + z\right) \cdot \left(1 + 1\right)} + t\right) + y \cdot 5 \]
      6. metadata-eval99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+31}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.04 \cdot 10^{-209}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 88.0% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.89999999999999999e31 or 2.09999999999999994e-8 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

    if -3.89999999999999999e31 < x < 3.2499999999999999e-208

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

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

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

    if 3.2499999999999999e-208 < x < 2.09999999999999994e-8

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+31}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 3.25 \cdot 10^{-208}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-8}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 88.5% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -0.0145000000000000007 or 2.7000000000000002e-9 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

    if -0.0145000000000000007 < x < 1.80000000000000008e-209

    1. Initial program 99.9%

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

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

    if 1.80000000000000008e-209 < x < 2.7000000000000002e-9

    1. Initial program 99.9%

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

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

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

Alternative 5: 65.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq 6 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.2499999999999998e-109 or 8.59999999999999999e-69 < x < 6.00000000000000021e45

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

    if -3.2499999999999998e-109 < x < 8.59999999999999999e-69

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative69.3%

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

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

    if 6.00000000000000021e45 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

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

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

Alternative 6: 99.1% accurate, 0.7× speedup?

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

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

    if -2.5 < x < 4.4000000000000002e-7

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

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

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

Alternative 7: 89.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+78} \lor \neg \left(z \leq 7 \cdot 10^{-11}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(\left(y + z\right) \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.3000000000000002e78 or 7.00000000000000038e-11 < z

    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. *-un-lft-identity100.0%

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

        \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right) + y \cdot 5 \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto x \cdot \left(\color{blue}{\left(y + z\right) \cdot \left(1 + 1\right)} + t\right) + y \cdot 5 \]
      6. metadata-eval100.0%

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

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

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

    if -2.3000000000000002e78 < z < 7.00000000000000038e-11

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

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

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

Alternative 8: 46.4% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.1000000000000002e-67

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

    if -2.1000000000000002e-67 < x < 3.79999999999999997e-45

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative66.2%

        \[\leadsto \color{blue}{y \cdot 5} \]
    7. Simplified66.2%

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

    if 3.79999999999999997e-45 < x < 7.9999999999999999e46

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot z\right) \cdot x} \]
    7. Simplified48.8%

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

    if 7.9999999999999999e46 < 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 inf 45.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-67}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+46}:\\ \;\;\;\;x \cdot \left(z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 88.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0145 \lor \neg \left(x \leq 3.8 \cdot 10^{-45}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.0145000000000000007 or 3.79999999999999997e-45 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

    if -0.0145000000000000007 < x < 3.79999999999999997e-45

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

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

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

Alternative 10: 78.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+65} \lor \neg \left(y \leq 3.1 \cdot 10^{+57}\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 -1.15e+65) (not (<= y 3.1e+57)))
   (* 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 <= -1.15e+65) || !(y <= 3.1e+57)) {
		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 <= (-1.15d+65)) .or. (.not. (y <= 3.1d+57))) 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 <= -1.15e+65) || !(y <= 3.1e+57)) {
		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 <= -1.15e+65) or not (y <= 3.1e+57):
		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 <= -1.15e+65) || !(y <= 3.1e+57))
		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 <= -1.15e+65) || ~((y <= 3.1e+57)))
		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, -1.15e+65], N[Not[LessEqual[y, 3.1e+57]], $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.15 \cdot 10^{+65} \lor \neg \left(y \leq 3.1 \cdot 10^{+57}\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.15e65 or 3.10000000000000013e57 < 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 82.7%

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

    if -1.15e65 < y < 3.10000000000000013e57

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+65} \lor \neg \left(y \leq 3.1 \cdot 10^{+57}\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 11: 62.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-67} \lor \neg \left(x \leq 1100\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1000000000000002e-67 or 1100 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

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

    if -2.1000000000000002e-67 < x < 1100

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative63.5%

        \[\leadsto \color{blue}{y \cdot 5} \]
    7. Simplified63.5%

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

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

Alternative 12: 46.5% accurate, 1.0× speedup?

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

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

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

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


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

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

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

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

    if -2.1000000000000002e-67 < x < 4.4000000000000002e-7

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative64.7%

        \[\leadsto \color{blue}{y \cdot 5} \]
    7. Simplified64.7%

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

    if 4.4000000000000002e-7 < 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 inf 39.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-67}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-7}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 46.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-67} \lor \neg \left(x \leq 1100\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.0499999999999999e-67 or 1100 < 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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    7. Simplified39.5%

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

    if -2.0499999999999999e-67 < x < 1100

    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. +-commutative99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
      4. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
      6. *-un-lft-identity100.0%

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

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
      8. *-un-lft-identity100.0%

        \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
      9. distribute-rgt-out100.0%

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

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

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative63.5%

        \[\leadsto \color{blue}{y \cdot 5} \]
    7. Simplified63.5%

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

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

Alternative 14: 99.9% accurate, 1.2× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Add Preprocessing
  3. 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. *-un-lft-identity99.9%

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

      \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right) + y \cdot 5 \]
    4. *-un-lft-identity99.9%

      \[\leadsto x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right) + y \cdot 5 \]
    5. distribute-rgt-out99.9%

      \[\leadsto x \cdot \left(\color{blue}{\left(y + z\right) \cdot \left(1 + 1\right)} + t\right) + y \cdot 5 \]
    6. metadata-eval99.9%

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

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

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

Alternative 15: 31.1% accurate, 5.0× speedup?

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

\\
x \cdot t
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(1 \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)\right)}\right) \]
    4. *-un-lft-identity100.0%

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t\right)\right) \]
    6. *-un-lft-identity100.0%

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

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{\left(y + z\right)}\right) + t\right)\right) \]
    8. *-un-lft-identity100.0%

      \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \left(\left(1 \cdot \left(y + z\right) + \color{blue}{1 \cdot \left(y + z\right)}\right) + t\right)\right) \]
    9. distribute-rgt-out100.0%

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

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

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

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

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

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

Reproduce

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