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

Percentage Accurate: 99.9% → 99.9%
Time: 6.4s
Alternatives: 10
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 10 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, 1.2× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Add Preprocessing
  3. 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. Final simplification100.0%

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

Alternative 2: 92.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.85 \cdot 10^{+76} \lor \neg \left(z \leq 9.2 \cdot 10^{-39}\right):\\ \;\;\;\;y \cdot 5 + x \cdot \left(t + z \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 -1.85e+76) (not (<= z 9.2e-39)))
   (+ (* y 5.0) (* x (+ t (* 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 <= -1.85e+76) || !(z <= 9.2e-39)) {
		tmp = (y * 5.0) + (x * (t + (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 <= (-1.85d+76)) .or. (.not. (z <= 9.2d-39))) then
        tmp = (y * 5.0d0) + (x * (t + (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 <= -1.85e+76) || !(z <= 9.2e-39)) {
		tmp = (y * 5.0) + (x * (t + (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 <= -1.85e+76) or not (z <= 9.2e-39):
		tmp = (y * 5.0) + (x * (t + (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 <= -1.85e+76) || !(z <= 9.2e-39))
		tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(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 <= -1.85e+76) || ~((z <= 9.2e-39)))
		tmp = (y * 5.0) + (x * (t + (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, -1.85e+76], N[Not[LessEqual[z, 9.2e-39]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $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 -1.85 \cdot 10^{+76} \lor \neg \left(z \leq 9.2 \cdot 10^{-39}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \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 < -1.85e76 or 9.20000000000000033e-39 < z

    1. Initial program 99.9%

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

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

    if -1.85e76 < z < 9.20000000000000033e-39

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

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

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

Alternative 3: 87.8% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.6999999999999999e60 or 5.50000000000000011e-100 < t

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

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

    if -2.6999999999999999e60 < t < 5.50000000000000011e-100

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

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

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

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

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

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

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

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

Alternative 4: 87.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+61}:\\
\;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\

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

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


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

    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 inf 81.7%

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

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    7. Simplified81.7%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    8. Taylor expanded in t around inf 81.8%

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

    if -8.8000000000000001e61 < t < 1.28000000000000006e95

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

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

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

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

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

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

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

    if 1.28000000000000006e95 < t

    1. Initial program 100.0%

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

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

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

Alternative 5: 72.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+59}:\\
\;\;\;\;t \cdot \left(x + 5 \cdot \frac{y}{t}\right)\\

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

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


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

    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 inf 81.7%

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

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    7. Simplified81.7%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    8. Taylor expanded in t around inf 81.8%

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

    if -6.20000000000000029e59 < t < 6.59999999999999993e-100

    1. Initial program 100.0%

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

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

    if 6.59999999999999993e-100 < t

    1. Initial program 100.0%

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

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

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

Alternative 6: 66.5% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-11} \lor \neg \left(y \leq 5.1 \cdot 10^{+97}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.7999999999999998e-11 or 5.10000000000000034e97 < 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 87.6%

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

    if -9.7999999999999998e-11 < y < 5.10000000000000034e97

    1. Initial program 100.0%

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

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

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

Alternative 7: 59.6% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.8e-38 or 1.00000000000000004e-25 < 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 77.2%

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

    if -3.8e-38 < y < 1.00000000000000004e-25

    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 inf 57.4%

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

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    7. Simplified57.4%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    8. Taylor expanded in t around inf 57.4%

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

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

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

Alternative 8: 46.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.75 \cdot 10^{-64}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-16}:\\ \;\;\;\;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.75e-64) (* x t) (if (<= x 5.2e-16) (* y 5.0) (* y (* x 2.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -2.75e-64) {
		tmp = x * t;
	} else if (x <= 5.2e-16) {
		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.75d-64)) then
        tmp = x * t
    else if (x <= 5.2d-16) 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.75e-64) {
		tmp = x * t;
	} else if (x <= 5.2e-16) {
		tmp = y * 5.0;
	} else {
		tmp = y * (x * 2.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -2.75e-64:
		tmp = x * t
	elif x <= 5.2e-16:
		tmp = y * 5.0
	else:
		tmp = y * (x * 2.0)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -2.75e-64)
		tmp = Float64(x * t);
	elseif (x <= 5.2e-16)
		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.75e-64)
		tmp = x * t;
	elseif (x <= 5.2e-16)
		tmp = y * 5.0;
	else
		tmp = y * (x * 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.75e-64], N[(x * t), $MachinePrecision], If[LessEqual[x, 5.2e-16], N[(y * 5.0), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 5.2 \cdot 10^{-16}:\\
\;\;\;\;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.7499999999999999e-64

    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 inf 52.6%

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

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    7. Simplified52.6%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    8. Taylor expanded in t around inf 52.6%

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

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

    if -2.7499999999999999e-64 < x < 5.1999999999999997e-16

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{y \cdot 5} \]
    6. Simplified58.9%

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

    if 5.1999999999999997e-16 < x

    1. Initial program 100.0%

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

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

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

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

Alternative 9: 47.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-69} \lor \neg \left(x \leq 4.4 \cdot 10^{-30}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.0999999999999999e-69 or 4.39999999999999967e-30 < 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. 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 inf 45.8%

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

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    7. Simplified45.8%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    8. Taylor expanded in t around inf 50.5%

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

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

    if -4.0999999999999999e-69 < x < 4.39999999999999967e-30

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

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

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

        \[\leadsto \color{blue}{y \cdot 5} \]
    6. Simplified59.3%

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

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

Alternative 10: 30.8% 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 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 inf 58.3%

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

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
  7. Simplified58.3%

    \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
  8. Taylor expanded in t around inf 55.4%

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

    \[\leadsto \color{blue}{t \cdot x} \]
  10. Final simplification31.0%

    \[\leadsto x \cdot t \]
  11. Add Preprocessing

Reproduce

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