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

Percentage Accurate: 99.9% → 100.0%
Time: 11.5s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.9% accurate, 0.1× speedup?

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

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

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

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

Alternative 3: 74.0% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq -2 \cdot 10^{+76}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.75 \cdot 10^{+45}:\\
\;\;\;\;y \cdot 5\\

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

\mathbf{elif}\;y \leq -2.5 \cdot 10^{-94} \lor \neg \left(y \leq -2.4 \cdot 10^{-116}\right) \land y \leq 8 \cdot 10^{+94}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.22000000000000004e143 or -2.4999999999999998e-94 < y < -2.39999999999999993e-116 or 8.0000000000000002e94 < y

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-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. Taylor expanded in y around inf 90.2%

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

    if -1.22000000000000004e143 < y < -2.0000000000000001e76 or -1.1e-23 < y < -2.4999999999999998e-94 or -2.39999999999999993e-116 < y < 8.0000000000000002e94

    1. Initial program 99.9%

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

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

    if -2.0000000000000001e76 < y < -1.75000000000000011e45

    1. Initial program 99.8%

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

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

    if -1.75000000000000011e45 < y < -1.1e-23

    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. Taylor expanded in t around 0 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.22 \cdot 10^{+143}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -2 \cdot 10^{+76}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.75 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-23}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{-94} \lor \neg \left(y \leq -2.4 \cdot 10^{-116}\right) \land y \leq 8 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 4: 88.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ t_3 := y \cdot 5 + x \cdot t\\ \mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{-250}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-107}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-47}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (* y 5.0) (* 2.0 (* x z))))
        (t_2 (* x (+ t (* (+ y z) 2.0))))
        (t_3 (+ (* y 5.0) (* x t))))
   (if (<= x -5.2e-14)
     t_2
     (if (<= x -2.45e-86)
       t_1
       (if (<= x -5.8e-250)
         t_3
         (if (<= x 5.4e-157)
           t_1
           (if (<= x 2.5e-107) t_3 (if (<= x 3.8e-47) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * 5.0) + (2.0 * (x * z));
	double t_2 = x * (t + ((y + z) * 2.0));
	double t_3 = (y * 5.0) + (x * t);
	double tmp;
	if (x <= -5.2e-14) {
		tmp = t_2;
	} else if (x <= -2.45e-86) {
		tmp = t_1;
	} else if (x <= -5.8e-250) {
		tmp = t_3;
	} else if (x <= 5.4e-157) {
		tmp = t_1;
	} else if (x <= 2.5e-107) {
		tmp = t_3;
	} else if (x <= 3.8e-47) {
		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) :: t_3
    real(8) :: tmp
    t_1 = (y * 5.0d0) + (2.0d0 * (x * z))
    t_2 = x * (t + ((y + z) * 2.0d0))
    t_3 = (y * 5.0d0) + (x * t)
    if (x <= (-5.2d-14)) then
        tmp = t_2
    else if (x <= (-2.45d-86)) then
        tmp = t_1
    else if (x <= (-5.8d-250)) then
        tmp = t_3
    else if (x <= 5.4d-157) then
        tmp = t_1
    else if (x <= 2.5d-107) then
        tmp = t_3
    else if (x <= 3.8d-47) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y * 5.0) + (2.0 * (x * z));
	double t_2 = x * (t + ((y + z) * 2.0));
	double t_3 = (y * 5.0) + (x * t);
	double tmp;
	if (x <= -5.2e-14) {
		tmp = t_2;
	} else if (x <= -2.45e-86) {
		tmp = t_1;
	} else if (x <= -5.8e-250) {
		tmp = t_3;
	} else if (x <= 5.4e-157) {
		tmp = t_1;
	} else if (x <= 2.5e-107) {
		tmp = t_3;
	} else if (x <= 3.8e-47) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y * 5.0) + (2.0 * (x * z))
	t_2 = x * (t + ((y + z) * 2.0))
	t_3 = (y * 5.0) + (x * t)
	tmp = 0
	if x <= -5.2e-14:
		tmp = t_2
	elif x <= -2.45e-86:
		tmp = t_1
	elif x <= -5.8e-250:
		tmp = t_3
	elif x <= 5.4e-157:
		tmp = t_1
	elif x <= 2.5e-107:
		tmp = t_3
	elif x <= 3.8e-47:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z)))
	t_2 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))
	t_3 = Float64(Float64(y * 5.0) + Float64(x * t))
	tmp = 0.0
	if (x <= -5.2e-14)
		tmp = t_2;
	elseif (x <= -2.45e-86)
		tmp = t_1;
	elseif (x <= -5.8e-250)
		tmp = t_3;
	elseif (x <= 5.4e-157)
		tmp = t_1;
	elseif (x <= 2.5e-107)
		tmp = t_3;
	elseif (x <= 3.8e-47)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y * 5.0) + (2.0 * (x * z));
	t_2 = x * (t + ((y + z) * 2.0));
	t_3 = (y * 5.0) + (x * t);
	tmp = 0.0;
	if (x <= -5.2e-14)
		tmp = t_2;
	elseif (x <= -2.45e-86)
		tmp = t_1;
	elseif (x <= -5.8e-250)
		tmp = t_3;
	elseif (x <= 5.4e-157)
		tmp = t_1;
	elseif (x <= 2.5e-107)
		tmp = t_3;
	elseif (x <= 3.8e-47)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.2e-14], t$95$2, If[LessEqual[x, -2.45e-86], t$95$1, If[LessEqual[x, -5.8e-250], t$95$3, If[LessEqual[x, 5.4e-157], t$95$1, If[LessEqual[x, 2.5e-107], t$95$3, If[LessEqual[x, 3.8e-47], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -2.45 \cdot 10^{-86}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -5.8 \cdot 10^{-250}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{-157}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.5 \cdot 10^{-107}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \leq 3.8 \cdot 10^{-47}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.19999999999999993e-14 or 3.80000000000000015e-47 < 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. Taylor expanded in x around inf 98.6%

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

    if -5.19999999999999993e-14 < x < -2.44999999999999986e-86 or -5.8000000000000004e-250 < x < 5.4e-157 or 2.49999999999999985e-107 < x < 3.80000000000000015e-47

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -2.44999999999999986e-86 < x < -5.8000000000000004e-250 or 5.4e-157 < x < 2.49999999999999985e-107

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, \color{blue}{t \cdot x}\right) \]
    5. Step-by-step derivation
      1. fma-udef88.1%

        \[\leadsto \color{blue}{y \cdot 5 + t \cdot x} \]
      2. *-commutative88.1%

        \[\leadsto y \cdot 5 + \color{blue}{x \cdot t} \]
    6. Applied egg-rr88.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-86}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{-250}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-157}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-107}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-47}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \end{array} \]

Alternative 5: 61.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ t_2 := x \cdot \left(t + y \cdot 2\right)\\ t_3 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{if}\;z \leq -5.7 \cdot 10^{+69}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-172}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-246}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-276}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+92}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ 5.0 (* x 2.0))))
        (t_2 (* x (+ t (* y 2.0))))
        (t_3 (* (+ y z) (* x 2.0))))
   (if (<= z -5.7e+69)
     t_3
     (if (<= z -3e+20)
       t_1
       (if (<= z -1.3e-172)
         t_2
         (if (<= z -6.2e-246)
           t_1
           (if (<= z -3.8e-276) t_2 (if (<= z 4.2e+92) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (5.0 + (x * 2.0));
	double t_2 = x * (t + (y * 2.0));
	double t_3 = (y + z) * (x * 2.0);
	double tmp;
	if (z <= -5.7e+69) {
		tmp = t_3;
	} else if (z <= -3e+20) {
		tmp = t_1;
	} else if (z <= -1.3e-172) {
		tmp = t_2;
	} else if (z <= -6.2e-246) {
		tmp = t_1;
	} else if (z <= -3.8e-276) {
		tmp = t_2;
	} else if (z <= 4.2e+92) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = y * (5.0d0 + (x * 2.0d0))
    t_2 = x * (t + (y * 2.0d0))
    t_3 = (y + z) * (x * 2.0d0)
    if (z <= (-5.7d+69)) then
        tmp = t_3
    else if (z <= (-3d+20)) then
        tmp = t_1
    else if (z <= (-1.3d-172)) then
        tmp = t_2
    else if (z <= (-6.2d-246)) then
        tmp = t_1
    else if (z <= (-3.8d-276)) then
        tmp = t_2
    else if (z <= 4.2d+92) then
        tmp = t_1
    else
        tmp = t_3
    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 t_2 = x * (t + (y * 2.0));
	double t_3 = (y + z) * (x * 2.0);
	double tmp;
	if (z <= -5.7e+69) {
		tmp = t_3;
	} else if (z <= -3e+20) {
		tmp = t_1;
	} else if (z <= -1.3e-172) {
		tmp = t_2;
	} else if (z <= -6.2e-246) {
		tmp = t_1;
	} else if (z <= -3.8e-276) {
		tmp = t_2;
	} else if (z <= 4.2e+92) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (5.0 + (x * 2.0))
	t_2 = x * (t + (y * 2.0))
	t_3 = (y + z) * (x * 2.0)
	tmp = 0
	if z <= -5.7e+69:
		tmp = t_3
	elif z <= -3e+20:
		tmp = t_1
	elif z <= -1.3e-172:
		tmp = t_2
	elif z <= -6.2e-246:
		tmp = t_1
	elif z <= -3.8e-276:
		tmp = t_2
	elif z <= 4.2e+92:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0)))
	t_2 = Float64(x * Float64(t + Float64(y * 2.0)))
	t_3 = Float64(Float64(y + z) * Float64(x * 2.0))
	tmp = 0.0
	if (z <= -5.7e+69)
		tmp = t_3;
	elseif (z <= -3e+20)
		tmp = t_1;
	elseif (z <= -1.3e-172)
		tmp = t_2;
	elseif (z <= -6.2e-246)
		tmp = t_1;
	elseif (z <= -3.8e-276)
		tmp = t_2;
	elseif (z <= 4.2e+92)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (5.0 + (x * 2.0));
	t_2 = x * (t + (y * 2.0));
	t_3 = (y + z) * (x * 2.0);
	tmp = 0.0;
	if (z <= -5.7e+69)
		tmp = t_3;
	elseif (z <= -3e+20)
		tmp = t_1;
	elseif (z <= -1.3e-172)
		tmp = t_2;
	elseif (z <= -6.2e-246)
		tmp = t_1;
	elseif (z <= -3.8e-276)
		tmp = t_2;
	elseif (z <= 4.2e+92)
		tmp = t_1;
	else
		tmp = t_3;
	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]}, Block[{t$95$2 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.7e+69], t$95$3, If[LessEqual[z, -3e+20], t$95$1, If[LessEqual[z, -1.3e-172], t$95$2, If[LessEqual[z, -6.2e-246], t$95$1, If[LessEqual[z, -3.8e-276], t$95$2, If[LessEqual[z, 4.2e+92], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3 \cdot 10^{+20}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-172}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-246}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-276}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+92}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.7e69 or 4.19999999999999972e92 < z

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) \cdot 2}, x, 5 \cdot y\right) \]
      4. *-commutative91.1%

        \[\leadsto \mathsf{fma}\left(\left(y + z\right) \cdot 2, x, \color{blue}{y \cdot 5}\right) \]
    6. Applied egg-rr91.1%

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

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

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

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

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

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

    if -5.7e69 < z < -3e20 or -1.2999999999999999e-172 < z < -6.2000000000000001e-246 or -3.8e-276 < z < 4.19999999999999972e92

    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. Taylor expanded in y around inf 65.4%

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

    if -3e20 < z < -1.2999999999999999e-172 or -6.2000000000000001e-246 < z < -3.8e-276

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.7 \cdot 10^{+69}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+20}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-172}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-246}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-276}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+92}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \end{array} \]

Alternative 6: 75.7% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;y \leq -1.26 \cdot 10^{+45}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq -2.4 \cdot 10^{-116}:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -8.9999999999999996e145 or 1.39999999999999999e94 < y

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Step-by-step derivation
      1. fma-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. Taylor expanded in y around inf 89.5%

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

    if -8.9999999999999996e145 < y < -1.26e45 or -1.04999999999999996e-31 < y < -2.39999999999999993e-116

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, \color{blue}{t \cdot x}\right) \]
    5. Step-by-step derivation
      1. fma-udef76.1%

        \[\leadsto \color{blue}{y \cdot 5 + t \cdot x} \]
      2. *-commutative76.1%

        \[\leadsto y \cdot 5 + \color{blue}{x \cdot t} \]
    6. Applied egg-rr76.1%

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

    if -1.26e45 < y < -1.04999999999999996e-31

    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. Taylor expanded in t around 0 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999993e-116 < y < 1.39999999999999999e94

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+145}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq -1.26 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-31}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-116}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 7: 47.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -1.15 \cdot 10^{+268}:\\ \;\;\;\;2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+160}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.25 \cdot 10^{-13}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{+168}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))))
   (if (<= x -1.15e+268)
     (* 2.0 (* y x))
     (if (<= x -1.6e+160)
       t_1
       (if (<= x -3.25e-13)
         (* x t)
         (if (<= x 3.8e-36) (* y 5.0) (if (<= x 6.6e+168) t_1 (* x t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -1.15e+268) {
		tmp = 2.0 * (y * x);
	} else if (x <= -1.6e+160) {
		tmp = t_1;
	} else if (x <= -3.25e-13) {
		tmp = x * t;
	} else if (x <= 3.8e-36) {
		tmp = y * 5.0;
	} else if (x <= 6.6e+168) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    if (x <= (-1.15d+268)) then
        tmp = 2.0d0 * (y * x)
    else if (x <= (-1.6d+160)) then
        tmp = t_1
    else if (x <= (-3.25d-13)) then
        tmp = x * t
    else if (x <= 3.8d-36) then
        tmp = y * 5.0d0
    else if (x <= 6.6d+168) then
        tmp = t_1
    else
        tmp = x * t
    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 <= -1.15e+268) {
		tmp = 2.0 * (y * x);
	} else if (x <= -1.6e+160) {
		tmp = t_1;
	} else if (x <= -3.25e-13) {
		tmp = x * t;
	} else if (x <= 3.8e-36) {
		tmp = y * 5.0;
	} else if (x <= 6.6e+168) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -1.15e+268:
		tmp = 2.0 * (y * x)
	elif x <= -1.6e+160:
		tmp = t_1
	elif x <= -3.25e-13:
		tmp = x * t
	elif x <= 3.8e-36:
		tmp = y * 5.0
	elif x <= 6.6e+168:
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (x <= -1.15e+268)
		tmp = Float64(2.0 * Float64(y * x));
	elseif (x <= -1.6e+160)
		tmp = t_1;
	elseif (x <= -3.25e-13)
		tmp = Float64(x * t);
	elseif (x <= 3.8e-36)
		tmp = Float64(y * 5.0);
	elseif (x <= 6.6e+168)
		tmp = t_1;
	else
		tmp = Float64(x * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	tmp = 0.0;
	if (x <= -1.15e+268)
		tmp = 2.0 * (y * x);
	elseif (x <= -1.6e+160)
		tmp = t_1;
	elseif (x <= -3.25e-13)
		tmp = x * t;
	elseif (x <= 3.8e-36)
		tmp = y * 5.0;
	elseif (x <= 6.6e+168)
		tmp = t_1;
	else
		tmp = x * t;
	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, -1.15e+268], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e+160], t$95$1, If[LessEqual[x, -3.25e-13], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.8e-36], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 6.6e+168], t$95$1, N[(x * t), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.6 \cdot 10^{+160}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -3.25 \cdot 10^{-13}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 6.6 \cdot 10^{+168}:\\
\;\;\;\;t_1\\

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


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

    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. Taylor expanded in x around inf 100.0%

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

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

    if -1.15000000000000006e268 < x < -1.5999999999999999e160 or 3.79999999999999971e-36 < x < 6.5999999999999997e168

    1. Initial program 100.0%

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

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

    if -1.5999999999999999e160 < x < -3.24999999999999978e-13 or 6.5999999999999997e168 < 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. Taylor expanded in t around inf 48.7%

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

    if -3.24999999999999978e-13 < x < 3.79999999999999971e-36

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+268}:\\ \;\;\;\;2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+160}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -3.25 \cdot 10^{-13}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{+168}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 8: 86.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;t \leq -3 \cdot 10^{+72}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 8.8 \cdot 10^{+137} \lor \neg \left(t \leq 1.2 \cdot 10^{+186}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.00000000000000003e72 or 3.3e94 < t < 8.80000000000000062e137 or 1.19999999999999998e186 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 5 + t \cdot x} \]
      2. *-commutative92.4%

        \[\leadsto y \cdot 5 + \color{blue}{x \cdot t} \]
    6. Applied egg-rr92.4%

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

    if -3.00000000000000003e72 < t < 3.3e94

    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. Taylor expanded in t around 0 91.5%

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

    if 8.80000000000000062e137 < t < 1.19999999999999998e186

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{+72}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{+94}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;t \leq 8.8 \cdot 10^{+137} \lor \neg \left(t \leq 1.2 \cdot 10^{+186}\right):\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]

Alternative 9: 62.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq -1.5 \cdot 10^{-30}:\\
\;\;\;\;x \cdot t\\

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.1e15 or 1.05e-35 < 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. Taylor expanded in t around 0 72.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y + z\right) \cdot 2}, x, 5 \cdot y\right) \]
      4. *-commutative72.8%

        \[\leadsto \mathsf{fma}\left(\left(y + z\right) \cdot 2, x, \color{blue}{y \cdot 5}\right) \]
    6. Applied egg-rr72.8%

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

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

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

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

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

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

    if -4.1e15 < x < -1.49999999999999995e-30

    1. Initial program 100.0%

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

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

    if -1.49999999999999995e-30 < x < -4.9999999999999999e-49

    1. Initial program 99.5%

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

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

    if -4.9999999999999999e-49 < x < 1.05e-35

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{+15}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-30}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-49}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-35}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \end{array} \]

Alternative 10: 88.0% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.7e71

    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. Taylor expanded in x around inf 88.0%

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

    if -3.7e71 < z < 6.7999999999999996e83

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if 6.7999999999999996e83 < z

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.7 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+83}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \end{array} \]

Alternative 11: 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 99.9%

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

    \[\leadsto x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5 \]

Alternative 12: 88.2% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.50000000000000036e-51 or 1.30000000000000002e-35 < 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. Taylor expanded in x around inf 97.7%

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

    if -8.50000000000000036e-51 < x < 1.30000000000000002e-35

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 5, \color{blue}{t \cdot x}\right) \]
    5. Step-by-step derivation
      1. fma-udef78.3%

        \[\leadsto \color{blue}{y \cdot 5 + t \cdot x} \]
      2. *-commutative78.3%

        \[\leadsto y \cdot 5 + \color{blue}{x \cdot t} \]
    6. Applied egg-rr78.3%

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

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

Alternative 13: 48.1% accurate, 2.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.99999999999999999e-15 or 1.45e-47 < 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. Taylor expanded in t around inf 38.8%

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

    if -4.99999999999999999e-15 < x < 1.45e-47

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-15}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-47}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 14: 47.5% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -300000:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\

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

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


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

    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. Taylor expanded in x around inf 100.0%

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

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

    if -3e5 < x < 5.99999999999999981e-50

    1. Initial program 99.9%

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

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

    if 5.99999999999999981e-50 < 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. Taylor expanded in t around inf 41.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -300000:\\ \;\;\;\;2 \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-50}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 15: 29.7% accurate, 5.0× speedup?

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

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

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

    \[\leadsto \color{blue}{5 \cdot y} \]
  3. Final simplification30.5%

    \[\leadsto y \cdot 5 \]

Reproduce

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