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

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

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(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. +-commutative100.0%

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

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

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

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

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

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

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

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

Alternative 2: 62.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \leq 1.02 \cdot 10^{-101}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.75 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 3.5 \cdot 10^{+183} \lor \neg \left(x \leq 5.5 \cdot 10^{+192}\right):\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.29999999999999989e-4 or 2.0500000000000001e-13 < x < 3.49999999999999987e183 or 5.49999999999999966e192 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.29999999999999989e-4 < x < 1.02e-101 or 1.75e-39 < x < 2.0500000000000001e-13

    1. Initial program 99.9%

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

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

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

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

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

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

    if 1.02e-101 < x < 1.75e-39 or 3.49999999999999987e183 < x < 5.49999999999999966e192

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.00013:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-101}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-39}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-13}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+183} \lor \neg \left(x \leq 5.5 \cdot 10^{+192}\right):\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 47.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x \leq 1.42 \cdot 10^{-101}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 9.2 \cdot 10^{+97}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.20000000000000009e-5 or 1.8000000000000001e-15 < x < 9.20000000000000022e97

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot x} \]
    6. Simplified45.2%

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

    if -8.20000000000000009e-5 < x < 1.4200000000000001e-101 or 1.35e-42 < x < 1.8000000000000001e-15

    1. Initial program 99.9%

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

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

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

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

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

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

    if 1.4200000000000001e-101 < x < 1.35e-42 or 9.20000000000000022e97 < x

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-5}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.42 \cdot 10^{-101}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-42}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-15}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+97}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ t_2 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -6.4 \cdot 10^{+106}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -1.06 \cdot 10^{+18}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-54}:\\ \;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+74}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* (+ y z) 2.0)))) (t_2 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -6.4e+106)
     t_2
     (if (<= y -1.06e+18)
       t_1
       (if (<= y -4.4e-54)
         (* t (+ x (* 5.0 (/ y t))))
         (if (<= y 1.1e+74) t_1 t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + ((y + z) * 2.0));
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -6.4e+106) {
		tmp = t_2;
	} else if (y <= -1.06e+18) {
		tmp = t_1;
	} else if (y <= -4.4e-54) {
		tmp = t * (x + (5.0 * (y / t)));
	} else if (y <= 1.1e+74) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (t + ((y + z) * 2.0d0))
    t_2 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-6.4d+106)) then
        tmp = t_2
    else if (y <= (-1.06d+18)) then
        tmp = t_1
    else if (y <= (-4.4d-54)) then
        tmp = t * (x + (5.0d0 * (y / t)))
    else if (y <= 1.1d+74) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (t + ((y + z) * 2.0));
	double t_2 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -6.4e+106) {
		tmp = t_2;
	} else if (y <= -1.06e+18) {
		tmp = t_1;
	} else if (y <= -4.4e-54) {
		tmp = t * (x + (5.0 * (y / t)));
	} else if (y <= 1.1e+74) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + ((y + z) * 2.0))
	t_2 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -6.4e+106:
		tmp = t_2
	elif y <= -1.06e+18:
		tmp = t_1
	elif y <= -4.4e-54:
		tmp = t * (x + (5.0 * (y / t)))
	elif y <= 1.1e+74:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))
	t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -6.4e+106)
		tmp = t_2;
	elseif (y <= -1.06e+18)
		tmp = t_1;
	elseif (y <= -4.4e-54)
		tmp = Float64(t * Float64(x + Float64(5.0 * Float64(y / t))));
	elseif (y <= 1.1e+74)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + ((y + z) * 2.0));
	t_2 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -6.4e+106)
		tmp = t_2;
	elseif (y <= -1.06e+18)
		tmp = t_1;
	elseif (y <= -4.4e-54)
		tmp = t * (x + (5.0 * (y / t)));
	elseif (y <= 1.1e+74)
		tmp = t_1;
	else
		tmp = t_2;
	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]}, Block[{t$95$2 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.4e+106], t$95$2, If[LessEqual[y, -1.06e+18], t$95$1, If[LessEqual[y, -4.4e-54], N[(t * N[(x + N[(5.0 * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+74], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.06 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -4.4 \cdot 10^{-54}:\\
\;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.3999999999999996e106 or 1.1000000000000001e74 < y

    1. Initial program 99.9%

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

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

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

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

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

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

    if -6.3999999999999996e106 < y < -1.06e18 or -4.3999999999999999e-54 < y < 1.1000000000000001e74

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.06e18 < y < -4.3999999999999999e-54

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine99.9%

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

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

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

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

        \[\leadsto y \cdot 5 + \color{blue}{\left(x \cdot \left(\left(\left(y + z\right) + z\right) + y\right) + x \cdot t\right)} \]
      6. associate-+r+99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+106}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.06 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-54}:\\ \;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+74}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.1% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;y \leq 2.1 \cdot 10^{+216} \lor \neg \left(y \leq 2.2 \cdot 10^{+279}\right):\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.59999999999999986e106 or 1.12e69 < y < 2.10000000000000001e216 or 2.2e279 < y

    1. Initial program 99.9%

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

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

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

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

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

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

    if -5.59999999999999986e106 < y < 1.12e69

    1. Initial program 100.0%

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

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

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

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

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

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

    if 2.10000000000000001e216 < y < 2.2e279

    1. Initial program 99.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{+106}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{+69}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{+216} \lor \neg \left(y \leq 2.2 \cdot 10^{+279}\right):\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 78.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq -4.8 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.7 \cdot 10^{-58}:\\
\;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\

\mathbf{elif}\;y \leq 1.25 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.7999999999999999e45 or 1.24999999999999998e72 < y

    1. Initial program 99.9%

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

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

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

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

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

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

    if -2.7999999999999999e45 < y < -4.8e17 or -1.69999999999999987e-58 < y < 1.24999999999999998e72

    1. Initial program 100.0%

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

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

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

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

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

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

    if -4.8e17 < y < -1.69999999999999987e-58

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine99.9%

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

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

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

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

        \[\leadsto y \cdot 5 + \color{blue}{\left(x \cdot \left(\left(\left(y + z\right) + z\right) + y\right) + x \cdot t\right)} \]
      6. associate-+r+99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+45}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{+17}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-58}:\\ \;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+72}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 88.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.75e9 or 2.9499999999999999e-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. Step-by-step derivation
      1. fma-define100.0%

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

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

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

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

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

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

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

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

    if -1.75e9 < x < 2.9499999999999999e-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. Step-by-step derivation
      1. fma-define99.9%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine99.9%

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

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

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

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

        \[\leadsto y \cdot 5 + \color{blue}{\left(x \cdot \left(\left(\left(y + z\right) + z\right) + y\right) + x \cdot t\right)} \]
      6. associate-+r+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 88.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.9e9 or 1.75e-12 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -1.9e9 < x < 1.75e-12

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine99.9%

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

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

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

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

        \[\leadsto y \cdot 5 + \color{blue}{\left(x \cdot \left(\left(\left(y + z\right) + z\right) + y\right) + x \cdot t\right)} \]
      6. associate-+r+99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.500000000000001e-5 or 1.29999999999999999e-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. Step-by-step derivation
      1. fma-define100.0%

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

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

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

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

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

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

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

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

    if -8.500000000000001e-5 < x < 1.29999999999999999e-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. Step-by-step derivation
      1. fma-define99.9%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine99.9%

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

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

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

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

        \[\leadsto y \cdot 5 + \color{blue}{\left(x \cdot \left(\left(\left(y + z\right) + z\right) + y\right) + x \cdot t\right)} \]
      6. associate-+r+99.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 78.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+43} \lor \neg \left(y \leq 4.6 \cdot 10^{+73}\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.85e+43) (not (<= y 4.6e+73)))
   (* 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.85e+43) || !(y <= 4.6e+73)) {
		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.85d+43)) .or. (.not. (y <= 4.6d+73))) 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.85e+43) || !(y <= 4.6e+73)) {
		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.85e+43) or not (y <= 4.6e+73):
		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.85e+43) || !(y <= 4.6e+73))
		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.85e+43) || ~((y <= 4.6e+73)))
		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.85e+43], N[Not[LessEqual[y, 4.6e+73]], $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.85 \cdot 10^{+43} \lor \neg \left(y \leq 4.6 \cdot 10^{+73}\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.85e43 or 4.6e73 < y

    1. Initial program 99.9%

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

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

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

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

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

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

    if -1.85e43 < y < 4.6e73

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+43} \lor \neg \left(y \leq 4.6 \cdot 10^{+73}\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: 47.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-5} \lor \neg \left(x \leq 1.35 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.20000000000000009e-5 or 1.35000000000000005e-15 < x

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot x} \]
    6. Simplified39.8%

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

    if -8.20000000000000009e-5 < x < 1.35000000000000005e-15

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 12: 99.9% accurate, 1.2× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \left(y + \left(z + z\right)\right) + \left(y + t\right), y \cdot 5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 30.3% accurate, 5.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{5 \cdot y} \]
  6. Final simplification31.7%

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

Reproduce

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