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

Percentage Accurate: 99.9% → 99.9%
Time: 11.0s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 46.6% accurate, 0.5× speedup?

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

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

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

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

\mathbf{elif}\;x \leq 2.85 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;x \leq 1.08 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.28e187 or 2.8500000000000002e-12 < x < 1.08e82

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

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

    if -1.28e187 < x < -2.8e57 or 1.08e82 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.8e57 < x < -9.19999999999999976e-97

    1. Initial program 100.0%

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

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

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

    if -9.19999999999999976e-97 < x < 2.8500000000000002e-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. Add Preprocessing
    3. Taylor expanded in x around 0 67.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.28 \cdot 10^{+187}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+57}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{-97}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-12}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{+82}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -3.1 \cdot 10^{+134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -2.55 \cdot 10^{+26}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq -3400 \lor \neg \left(y \leq 1.08 \cdot 10^{-48}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -3.1e+134)
     t_1
     (if (<= y -2.55e+26)
       (+ (* y 5.0) (* x t))
       (if (or (<= y -3400.0) (not (<= y 1.08e-48)))
         t_1
         (* x (+ t (* 2.0 z))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -3.1e+134) {
		tmp = t_1;
	} else if (y <= -2.55e+26) {
		tmp = (y * 5.0) + (x * t);
	} else if ((y <= -3400.0) || !(y <= 1.08e-48)) {
		tmp = t_1;
	} else {
		tmp = x * (t + (2.0 * 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) :: t_1
    real(8) :: tmp
    t_1 = y * (5.0d0 + (x * 2.0d0))
    if (y <= (-3.1d+134)) then
        tmp = t_1
    else if (y <= (-2.55d+26)) then
        tmp = (y * 5.0d0) + (x * t)
    else if ((y <= (-3400.0d0)) .or. (.not. (y <= 1.08d-48))) then
        tmp = t_1
    else
        tmp = x * (t + (2.0d0 * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double tmp;
	if (y <= -3.1e+134) {
		tmp = t_1;
	} else if (y <= -2.55e+26) {
		tmp = (y * 5.0) + (x * t);
	} else if ((y <= -3400.0) || !(y <= 1.08e-48)) {
		tmp = t_1;
	} else {
		tmp = x * (t + (2.0 * z));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -3.1e+134:
		tmp = t_1
	elif y <= -2.55e+26:
		tmp = (y * 5.0) + (x * t)
	elif (y <= -3400.0) or not (y <= 1.08e-48):
		tmp = t_1
	else:
		tmp = x * (t + (2.0 * z))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	tmp = 0.0
	if (y <= -3.1e+134)
		tmp = t_1;
	elseif (y <= -2.55e+26)
		tmp = Float64(Float64(y * 5.0) + Float64(x * t));
	elseif ((y <= -3400.0) || !(y <= 1.08e-48))
		tmp = t_1;
	else
		tmp = Float64(x * Float64(t + Float64(2.0 * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (5.0 + (x * 2.0));
	tmp = 0.0;
	if (y <= -3.1e+134)
		tmp = t_1;
	elseif (y <= -2.55e+26)
		tmp = (y * 5.0) + (x * t);
	elseif ((y <= -3400.0) || ~((y <= 1.08e-48)))
		tmp = t_1;
	else
		tmp = x * (t + (2.0 * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+134], t$95$1, If[LessEqual[y, -2.55e+26], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -3400.0], N[Not[LessEqual[y, 1.08e-48]], $MachinePrecision]], t$95$1, N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -3400 \lor \neg \left(y \leq 1.08 \cdot 10^{-48}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.09999999999999982e134 or -2.5499999999999999e26 < y < -3400 or 1.08e-48 < y

    1. Initial program 100.0%

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

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

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

    if -3.09999999999999982e134 < y < -2.5499999999999999e26

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

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

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

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

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

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

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(2 \cdot y\right)}\right) + y \cdot 5 \]
      6. count-285.9%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(y + y\right)}\right) + y \cdot 5 \]
      7. flip-+0.0%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\frac{y \cdot y - y \cdot y}{y - y}}\right) + y \cdot 5 \]
      8. +-inverses0.0%

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

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

      \[\leadsto \color{blue}{\left(x \cdot t + x \cdot \frac{0}{0}\right)} + y \cdot 5 \]
    6. Simplified82.8%

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

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

    if -3400 < y < 1.08e-48

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+134}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.55 \cdot 10^{+26}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq -3400 \lor \neg \left(y \leq 1.08 \cdot 10^{-48}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 64.8% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;x \leq -6.2 \cdot 10^{-98}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-14}:\\
\;\;\;\;y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.50000000000000033e192 or -4e53 < x < -6.2e-98

    1. Initial program 100.0%

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

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

    if -6.50000000000000033e192 < x < -4e53 or 2.9999999999999998e-14 < x

    1. Initial program 100.0%

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

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

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

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

    if -6.2e-98 < x < 2.9999999999999998e-14

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+192}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;x \leq -4 \cdot 10^{+53}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-98}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-14}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 88.9% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;x \leq 26000:\\
\;\;\;\;x \cdot t\_1 + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.25000000000000001e-51 or 26000 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.25000000000000001e-51 < x < -2.4499999999999998e-248

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

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

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

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

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

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

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(2 \cdot y\right)}\right) + y \cdot 5 \]
      6. count-285.9%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(y + y\right)}\right) + y \cdot 5 \]
      7. flip-+0.0%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\frac{y \cdot y - y \cdot y}{y - y}}\right) + y \cdot 5 \]
      8. +-inverses0.0%

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

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

      \[\leadsto \color{blue}{\left(x \cdot t + x \cdot \frac{0}{0}\right)} + y \cdot 5 \]
    6. Simplified85.9%

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

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

    if -2.4499999999999998e-248 < x < 26000

    1. Initial program 99.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-248}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 26000:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 62.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-95}:\\
\;\;\;\;x \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.49999999999999962e-50 or 1.01999999999999994e-11 < x

    1. Initial program 100.0%

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

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

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

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

    if -4.49999999999999962e-50 < x < -6e-95

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

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

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

    if -6e-95 < x < 1.01999999999999994e-11

    1. Initial program 99.9%

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

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

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

Alternative 7: 89.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+26} \lor \neg \left(t \leq 0.00075\right):\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9000000000000001e26 or 7.5000000000000002e-4 < 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 91.2%

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

    if -1.9000000000000001e26 < t < 7.5000000000000002e-4

    1. Initial program 99.9%

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

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

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

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

Alternative 8: 46.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -3.5 \cdot 10^{-53}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-96}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-10}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))))
   (if (<= x -3.5e-53)
     t_1
     (if (<= x -8e-96) (* x t) (if (<= x 2.85e-10) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -3.5e-53) {
		tmp = t_1;
	} else if (x <= -8e-96) {
		tmp = x * t;
	} else if (x <= 2.85e-10) {
		tmp = y * 5.0;
	} 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 <= (-3.5d-53)) then
        tmp = t_1
    else if (x <= (-8d-96)) then
        tmp = x * t
    else if (x <= 2.85d-10) then
        tmp = y * 5.0d0
    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 <= -3.5e-53) {
		tmp = t_1;
	} else if (x <= -8e-96) {
		tmp = x * t;
	} else if (x <= 2.85e-10) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -3.5e-53:
		tmp = t_1
	elif x <= -8e-96:
		tmp = x * t
	elif x <= 2.85e-10:
		tmp = y * 5.0
	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 <= -3.5e-53)
		tmp = t_1;
	elseif (x <= -8e-96)
		tmp = Float64(x * t);
	elseif (x <= 2.85e-10)
		tmp = Float64(y * 5.0);
	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 <= -3.5e-53)
		tmp = t_1;
	elseif (x <= -8e-96)
		tmp = x * t;
	elseif (x <= 2.85e-10)
		tmp = y * 5.0;
	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, -3.5e-53], t$95$1, If[LessEqual[x, -8e-96], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.85e-10], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -8 \cdot 10^{-96}:\\
\;\;\;\;x \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.49999999999999993e-53 or 2.84999999999999998e-10 < 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 z around inf 44.8%

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

    if -3.49999999999999993e-53 < x < -7.9999999999999993e-96

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

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

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

    if -7.9999999999999993e-96 < x < 2.84999999999999998e-10

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{-53}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-96}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-10}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 88.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-54} \lor \neg \left(x \leq 1.38 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.35e-54 or 1.38000000000000002e-14 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -2.35e-54 < x < 1.38000000000000002e-14

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

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

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

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

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

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

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(2 \cdot y\right)}\right) + y \cdot 5 \]
      6. count-283.1%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\left(y + y\right)}\right) + y \cdot 5 \]
      7. flip-+0.0%

        \[\leadsto \left(x \cdot t + x \cdot \color{blue}{\frac{y \cdot y - y \cdot y}{y - y}}\right) + y \cdot 5 \]
      8. +-inverses0.0%

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

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

      \[\leadsto \color{blue}{\left(x \cdot t + x \cdot \frac{0}{0}\right)} + y \cdot 5 \]
    6. Simplified83.1%

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

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

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

Alternative 10: 77.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -12000 or 1.08e-48 < 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 76.4%

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

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

    if -12000 < y < 1.08e-48

    1. Initial program 100.0%

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

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

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

Alternative 11: 62.9% accurate, 0.9× speedup?

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

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

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

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


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

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

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

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

    if -6e-95 < x < 5.99999999999999968e-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. Add Preprocessing
    3. Taylor expanded in x around 0 67.2%

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

    if 5.99999999999999968e-13 < x

    1. Initial program 100.0%

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

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

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

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

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

Alternative 12: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 13: 47.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-95} \lor \neg \left(x \leq 3.7 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.99999999999999996e-95 or 3.6999999999999999e-26 < x

    1. Initial program 100.0%

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

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

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

    if -3.99999999999999996e-95 < x < 3.6999999999999999e-26

    1. Initial program 99.9%

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

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

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

Alternative 14: 29.6% accurate, 5.0× speedup?

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

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

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

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

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

Reproduce

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