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

Percentage Accurate: 99.9% → 100.0%
Time: 10.0s
Alternatives: 16
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 16 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 -1.05 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.9 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -1.06 \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 10^{+93}:\\ \;\;\;\;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 -1.05e+76)
       t_1
       (if (<= y -4.9e+45)
         (* y 5.0)
         (if (<= y -1.06e-23)
           (* (+ y z) (* x 2.0))
           (if (or (<= y -2.5e-94) (and (not (<= y -2.4e-116)) (<= y 1e+93)))
             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 <= -1.05e+76) {
		tmp = t_1;
	} else if (y <= -4.9e+45) {
		tmp = y * 5.0;
	} else if (y <= -1.06e-23) {
		tmp = (y + z) * (x * 2.0);
	} else if ((y <= -2.5e-94) || (!(y <= -2.4e-116) && (y <= 1e+93))) {
		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 <= (-1.05d+76)) then
        tmp = t_1
    else if (y <= (-4.9d+45)) then
        tmp = y * 5.0d0
    else if (y <= (-1.06d-23)) then
        tmp = (y + z) * (x * 2.0d0)
    else if ((y <= (-2.5d-94)) .or. (.not. (y <= (-2.4d-116))) .and. (y <= 1d+93)) 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 <= -1.05e+76) {
		tmp = t_1;
	} else if (y <= -4.9e+45) {
		tmp = y * 5.0;
	} else if (y <= -1.06e-23) {
		tmp = (y + z) * (x * 2.0);
	} else if ((y <= -2.5e-94) || (!(y <= -2.4e-116) && (y <= 1e+93))) {
		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 <= -1.05e+76:
		tmp = t_1
	elif y <= -4.9e+45:
		tmp = y * 5.0
	elif y <= -1.06e-23:
		tmp = (y + z) * (x * 2.0)
	elif (y <= -2.5e-94) or (not (y <= -2.4e-116) and (y <= 1e+93)):
		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 <= -1.05e+76)
		tmp = t_1;
	elseif (y <= -4.9e+45)
		tmp = Float64(y * 5.0);
	elseif (y <= -1.06e-23)
		tmp = Float64(Float64(y + z) * Float64(x * 2.0));
	elseif ((y <= -2.5e-94) || (!(y <= -2.4e-116) && (y <= 1e+93)))
		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 <= -1.05e+76)
		tmp = t_1;
	elseif (y <= -4.9e+45)
		tmp = y * 5.0;
	elseif (y <= -1.06e-23)
		tmp = (y + z) * (x * 2.0);
	elseif ((y <= -2.5e-94) || (~((y <= -2.4e-116)) && (y <= 1e+93)))
		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, -1.05e+76], t$95$1, If[LessEqual[y, -4.9e+45], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -1.06e-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, 1e+93]]], 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 -1.05 \cdot 10^{+76}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq -1.06 \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 10^{+93}:\\
\;\;\;\;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 1.00000000000000004e93 < 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. Taylor expanded in y around inf 90.2%

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

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

    if -1.22000000000000004e143 < y < -1.05000000000000003e76 or -1.05999999999999994e-23 < y < -2.4999999999999998e-94 or -2.39999999999999993e-116 < y < 1.00000000000000004e93

    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}{x \cdot \left(t + 2 \cdot z\right)} \]

    if -1.05000000000000003e76 < y < -4.9000000000000002e45

    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 -4.9000000000000002e45 < y < -1.05999999999999994e-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(x \cdot \left(y + z\right)\right) + 5 \cdot y} \]
    5. Step-by-step derivation
      1. associate-*r*100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(y + z\right) \cdot \left(2 \cdot x\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 -1.05 \cdot 10^{+76}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;y \leq -4.9 \cdot 10^{+45}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;y \leq -1.06 \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 10^{+93}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]

Alternative 4: 65.7% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;x \leq -1 \cdot 10^{+163}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -4.6 \cdot 10^{+37}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-149} \lor \neg \left(x \leq 2.4 \cdot 10^{-152}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.2000000000000001e267 or -9.9999999999999994e162 < x < -4.60000000000000005e37

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

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

    if -3.2000000000000001e267 < x < -9.9999999999999994e162 or -4.60000000000000005e37 < x < -2.59999999999999999e-149 or 2.4e-152 < 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 y around 0 71.7%

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

    if -2.59999999999999999e-149 < x < 2.4e-152

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{+267}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -1 \cdot 10^{+163}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{+37}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-149} \lor \neg \left(x \leq 2.4 \cdot 10^{-152}\right):\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 5: 80.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+143} \lor \neg \left(y \leq -2.5 \cdot 10^{-94}\right) \land \left(y \leq -2.4 \cdot 10^{-116} \lor \neg \left(y \leq 1.75 \cdot 10^{+92}\right)\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.22000000000000004e143 or -2.4999999999999998e-94 < y < -2.39999999999999993e-116 or 1.74999999999999993e92 < 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. Taylor expanded in y around inf 90.2%

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

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

    if -1.22000000000000004e143 < y < -2.4999999999999998e-94 or -2.39999999999999993e-116 < y < 1.74999999999999993e92

    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 x around inf 83.5%

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

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

Alternative 6: 97.8% accurate, 0.9× speedup?

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

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

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


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

    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}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -5.0000000000000004e189 < x

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

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

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

Alternative 7: 47.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+274}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+159}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-14}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+159}:\\ \;\;\;\;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 -2.9e+274)
     (* x t)
     (if (<= x -6e+159)
       t_1
       (if (<= x -5.5e-14)
         (* x t)
         (if (<= x 6e-36) (* y 5.0) (if (<= x 1.45e+159) 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 <= -2.9e+274) {
		tmp = x * t;
	} else if (x <= -6e+159) {
		tmp = t_1;
	} else if (x <= -5.5e-14) {
		tmp = x * t;
	} else if (x <= 6e-36) {
		tmp = y * 5.0;
	} else if (x <= 1.45e+159) {
		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 <= (-2.9d+274)) then
        tmp = x * t
    else if (x <= (-6d+159)) then
        tmp = t_1
    else if (x <= (-5.5d-14)) then
        tmp = x * t
    else if (x <= 6d-36) then
        tmp = y * 5.0d0
    else if (x <= 1.45d+159) 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 <= -2.9e+274) {
		tmp = x * t;
	} else if (x <= -6e+159) {
		tmp = t_1;
	} else if (x <= -5.5e-14) {
		tmp = x * t;
	} else if (x <= 6e-36) {
		tmp = y * 5.0;
	} else if (x <= 1.45e+159) {
		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 <= -2.9e+274:
		tmp = x * t
	elif x <= -6e+159:
		tmp = t_1
	elif x <= -5.5e-14:
		tmp = x * t
	elif x <= 6e-36:
		tmp = y * 5.0
	elif x <= 1.45e+159:
		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 <= -2.9e+274)
		tmp = Float64(x * t);
	elseif (x <= -6e+159)
		tmp = t_1;
	elseif (x <= -5.5e-14)
		tmp = Float64(x * t);
	elseif (x <= 6e-36)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.45e+159)
		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 <= -2.9e+274)
		tmp = x * t;
	elseif (x <= -6e+159)
		tmp = t_1;
	elseif (x <= -5.5e-14)
		tmp = x * t;
	elseif (x <= 6e-36)
		tmp = y * 5.0;
	elseif (x <= 1.45e+159)
		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, -2.9e+274], N[(x * t), $MachinePrecision], If[LessEqual[x, -6e+159], t$95$1, If[LessEqual[x, -5.5e-14], N[(x * t), $MachinePrecision], If[LessEqual[x, 6e-36], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.45e+159], 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 -2.9 \cdot 10^{+274}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+159}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 1.45 \cdot 10^{+159}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.9e274 or -6.0000000000000004e159 < x < -5.49999999999999991e-14 or 1.45000000000000007e159 < 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 49.8%

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

    if -2.9e274 < x < -6.0000000000000004e159 or 6.0000000000000003e-36 < x < 1.45000000000000007e159

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

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

    if -5.49999999999999991e-14 < x < 6.0000000000000003e-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 3 regimes into one program.
  4. Final simplification55.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+274}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+159}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-14}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-36}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+159}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 8: 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 -2.05 \cdot 10^{+267}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{+161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-15}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-35}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+157}:\\ \;\;\;\;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 -2.05e+267)
     (* y (* x 2.0))
     (if (<= x -4.1e+161)
       t_1
       (if (<= x -2.25e-15)
         (* x t)
         (if (<= x 2.5e-35) (* y 5.0) (if (<= x 3.3e+157) 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 <= -2.05e+267) {
		tmp = y * (x * 2.0);
	} else if (x <= -4.1e+161) {
		tmp = t_1;
	} else if (x <= -2.25e-15) {
		tmp = x * t;
	} else if (x <= 2.5e-35) {
		tmp = y * 5.0;
	} else if (x <= 3.3e+157) {
		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 <= (-2.05d+267)) then
        tmp = y * (x * 2.0d0)
    else if (x <= (-4.1d+161)) then
        tmp = t_1
    else if (x <= (-2.25d-15)) then
        tmp = x * t
    else if (x <= 2.5d-35) then
        tmp = y * 5.0d0
    else if (x <= 3.3d+157) 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 <= -2.05e+267) {
		tmp = y * (x * 2.0);
	} else if (x <= -4.1e+161) {
		tmp = t_1;
	} else if (x <= -2.25e-15) {
		tmp = x * t;
	} else if (x <= 2.5e-35) {
		tmp = y * 5.0;
	} else if (x <= 3.3e+157) {
		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 <= -2.05e+267:
		tmp = y * (x * 2.0)
	elif x <= -4.1e+161:
		tmp = t_1
	elif x <= -2.25e-15:
		tmp = x * t
	elif x <= 2.5e-35:
		tmp = y * 5.0
	elif x <= 3.3e+157:
		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 <= -2.05e+267)
		tmp = Float64(y * Float64(x * 2.0));
	elseif (x <= -4.1e+161)
		tmp = t_1;
	elseif (x <= -2.25e-15)
		tmp = Float64(x * t);
	elseif (x <= 2.5e-35)
		tmp = Float64(y * 5.0);
	elseif (x <= 3.3e+157)
		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 <= -2.05e+267)
		tmp = y * (x * 2.0);
	elseif (x <= -4.1e+161)
		tmp = t_1;
	elseif (x <= -2.25e-15)
		tmp = x * t;
	elseif (x <= 2.5e-35)
		tmp = y * 5.0;
	elseif (x <= 3.3e+157)
		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, -2.05e+267], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e+161], t$95$1, If[LessEqual[x, -2.25e-15], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.5e-35], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3.3e+157], 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 -2.05 \cdot 10^{+267}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;x \leq -4.1 \cdot 10^{+161}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.25 \cdot 10^{-15}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+157}:\\
\;\;\;\;t_1\\

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


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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(x \cdot 2\right)} \]
      4. *-commutative55.9%

        \[\leadsto y \cdot \color{blue}{\left(2 \cdot x\right)} \]
    7. Simplified55.9%

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

    if -2.04999999999999999e267 < x < -4.1000000000000001e161 or 2.49999999999999982e-35 < x < 3.3000000000000002e157

    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(x \cdot z\right)} \]

    if -4.1000000000000001e161 < x < -2.2499999999999999e-15 or 3.3000000000000002e157 < 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 -2.2499999999999999e-15 < x < 2.49999999999999982e-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 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 -2.05 \cdot 10^{+267}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{+161}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-15}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-35}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+157}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 9: 75.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+143} \lor \neg \left(y \leq -2.5 \cdot 10^{-94}\right) \land \left(y \leq -2.4 \cdot 10^{-116} \lor \neg \left(y \leq 2.4 \cdot 10^{+92}\right)\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.22000000000000004e143 or -2.4999999999999998e-94 < y < -2.39999999999999993e-116 or 2.40000000000000005e92 < 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. Taylor expanded in y around inf 90.2%

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

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

    if -1.22000000000000004e143 < y < -2.4999999999999998e-94 or -2.39999999999999993e-116 < y < 2.40000000000000005e92

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

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

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

Alternative 10: 85.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{-116} \lor \neg \left(y \leq 4.6 \cdot 10^{+26}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.05999999999999997e-116 or 4.6000000000000001e26 < 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-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 89.1%

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

    if -1.05999999999999997e-116 < y < 4.6000000000000001e26

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

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

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

Alternative 11: 88.0% accurate, 1.0× speedup?

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

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

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

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


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

    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}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -1.09e71 < z < 8.4999999999999995e83

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

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

    if 8.4999999999999995e83 < 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(x \cdot \left(y + z\right)\right) + 5 \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.6%

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

Alternative 12: 99.9% accurate, 1.0× speedup?

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

\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Derivation
  1. Initial program 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 13: 58.6% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;z \leq -2.1 \cdot 10^{+22}:\\
\;\;\;\;y \cdot 5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.0500000000000001e71 or 8.20000000000000055e88 < 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. Taylor expanded in z around inf 69.1%

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

    if -2.0500000000000001e71 < z < -2.0999999999999998e22

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

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

    if -2.0999999999999998e22 < z < 8.20000000000000055e88

    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 x around inf 66.5%

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

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

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

Alternative 14: 88.9% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.2000000000000001e-14 or 1.55000000000000008e-48 < 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}{x \cdot \left(t + 2 \cdot \left(y + z\right)\right)} \]

    if -2.2000000000000001e-14 < x < 1.55000000000000008e-48

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

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

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

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

Alternative 15: 48.0% accurate, 2.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.35000000000000005e-15 or 1.04999999999999989e-53 < 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 -1.35000000000000005e-15 < x < 1.04999999999999989e-53

    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 -1.35 \cdot 10^{-15} \lor \neg \left(x \leq 1.05 \cdot 10^{-53}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]

Alternative 16: 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)))