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

Percentage Accurate: 99.9% → 99.9%
Time: 9.6s
Alternatives: 11
Speedup: 0.1×

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 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Derivation
  1. Initial program 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. Add Preprocessing
  5. Final simplification99.9%

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

Alternative 2: 65.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot z\right)\\ t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{+188}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-30}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+52} \lor \neg \left(x \leq 1.96 \cdot 10^{+167}\right) \land x \leq 2.7 \cdot 10^{+206}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* 2.0 z)))) (t_2 (* x (* 2.0 (+ y z)))))
   (if (<= x -3e+188)
     t_2
     (if (<= x -5.5e-68)
       t_1
       (if (<= x 5e-126)
         (* y 5.0)
         (if (<= x 8e-81)
           t_1
           (if (<= x 2.85e-30)
             (* y 5.0)
             (if (or (<= x 2.3e+52)
                     (and (not (<= x 1.96e+167)) (<= x 2.7e+206)))
               t_1
               t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * z));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -3e+188) {
		tmp = t_2;
	} else if (x <= -5.5e-68) {
		tmp = t_1;
	} else if (x <= 5e-126) {
		tmp = y * 5.0;
	} else if (x <= 8e-81) {
		tmp = t_1;
	} else if (x <= 2.85e-30) {
		tmp = y * 5.0;
	} else if ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206))) {
		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 + (2.0d0 * z))
    t_2 = x * (2.0d0 * (y + z))
    if (x <= (-3d+188)) then
        tmp = t_2
    else if (x <= (-5.5d-68)) then
        tmp = t_1
    else if (x <= 5d-126) then
        tmp = y * 5.0d0
    else if (x <= 8d-81) then
        tmp = t_1
    else if (x <= 2.85d-30) then
        tmp = y * 5.0d0
    else if ((x <= 2.3d+52) .or. (.not. (x <= 1.96d+167)) .and. (x <= 2.7d+206)) 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 + (2.0 * z));
	double t_2 = x * (2.0 * (y + z));
	double tmp;
	if (x <= -3e+188) {
		tmp = t_2;
	} else if (x <= -5.5e-68) {
		tmp = t_1;
	} else if (x <= 5e-126) {
		tmp = y * 5.0;
	} else if (x <= 8e-81) {
		tmp = t_1;
	} else if (x <= 2.85e-30) {
		tmp = y * 5.0;
	} else if ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * z))
	t_2 = x * (2.0 * (y + z))
	tmp = 0
	if x <= -3e+188:
		tmp = t_2
	elif x <= -5.5e-68:
		tmp = t_1
	elif x <= 5e-126:
		tmp = y * 5.0
	elif x <= 8e-81:
		tmp = t_1
	elif x <= 2.85e-30:
		tmp = y * 5.0
	elif (x <= 2.3e+52) or (not (x <= 1.96e+167) and (x <= 2.7e+206)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * z)))
	t_2 = Float64(x * Float64(2.0 * Float64(y + z)))
	tmp = 0.0
	if (x <= -3e+188)
		tmp = t_2;
	elseif (x <= -5.5e-68)
		tmp = t_1;
	elseif (x <= 5e-126)
		tmp = Float64(y * 5.0);
	elseif (x <= 8e-81)
		tmp = t_1;
	elseif (x <= 2.85e-30)
		tmp = Float64(y * 5.0);
	elseif ((x <= 2.3e+52) || (!(x <= 1.96e+167) && (x <= 2.7e+206)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * z));
	t_2 = x * (2.0 * (y + z));
	tmp = 0.0;
	if (x <= -3e+188)
		tmp = t_2;
	elseif (x <= -5.5e-68)
		tmp = t_1;
	elseif (x <= 5e-126)
		tmp = y * 5.0;
	elseif (x <= 8e-81)
		tmp = t_1;
	elseif (x <= 2.85e-30)
		tmp = y * 5.0;
	elseif ((x <= 2.3e+52) || (~((x <= 1.96e+167)) && (x <= 2.7e+206)))
		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[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+188], t$95$2, If[LessEqual[x, -5.5e-68], t$95$1, If[LessEqual[x, 5e-126], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 8e-81], t$95$1, If[LessEqual[x, 2.85e-30], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 2.3e+52], And[N[Not[LessEqual[x, 1.96e+167]], $MachinePrecision], LessEqual[x, 2.7e+206]]], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-68}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 8 \cdot 10^{-81}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 2.3 \cdot 10^{+52} \lor \neg \left(x \leq 1.96 \cdot 10^{+167}\right) \land x \leq 2.7 \cdot 10^{+206}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.0000000000000001e188 or 2.3e52 < x < 1.95999999999999988e167 or 2.70000000000000003e206 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if -3.0000000000000001e188 < x < -5.5000000000000003e-68 or 5.00000000000000006e-126 < x < 7.9999999999999997e-81 or 2.84999999999999989e-30 < x < 2.3e52 or 1.95999999999999988e167 < x < 2.70000000000000003e206

    1. Initial program 99.9%

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

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

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

    if -5.5000000000000003e-68 < x < 5.00000000000000006e-126 or 7.9999999999999997e-81 < x < 2.84999999999999989e-30

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified72.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+188}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-81}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-30}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+52} \lor \neg \left(x \leq 1.96 \cdot 10^{+167}\right) \land x \leq 2.7 \cdot 10^{+206}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.5% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq -9 \cdot 10^{+91}:\\
\;\;\;\;x \cdot t\\

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

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

\mathbf{elif}\;x \leq 1.1 \cdot 10^{-91}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 6.8 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.54999999999999986e123 or -9e91 < x < -1.00000000000000007e-63 or 6.8e45 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if -2.54999999999999986e123 < x < -9e91 or 5.00000000000000006e-126 < x < 1.1e-91 or 2.49999999999999986e-30 < x < 6.8e45

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified70.7%

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

    if -1.00000000000000007e-63 < x < 5.00000000000000006e-126 or 1.1e-91 < x < 2.49999999999999986e-30

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified72.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.55 \cdot 10^{+123}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+91}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-91}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-30}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+45}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 46.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -4 \cdot 10^{+193}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{+39}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-84}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-32}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+103}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))))
   (if (<= x -4e+193)
     t_1
     (if (<= x -1.4e+39)
       (* x t)
       (if (<= x -3e-55)
         t_1
         (if (<= x 4.6e-126)
           (* y 5.0)
           (if (<= x 9.5e-84)
             (* x t)
             (if (<= x 1.2e-32)
               (* y 5.0)
               (if (<= x 1.4e+103) (* x t) t_1)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -4e+193) {
		tmp = t_1;
	} else if (x <= -1.4e+39) {
		tmp = x * t;
	} else if (x <= -3e-55) {
		tmp = t_1;
	} else if (x <= 4.6e-126) {
		tmp = y * 5.0;
	} else if (x <= 9.5e-84) {
		tmp = x * t;
	} else if (x <= 1.2e-32) {
		tmp = y * 5.0;
	} else if (x <= 1.4e+103) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    if (x <= (-4d+193)) then
        tmp = t_1
    else if (x <= (-1.4d+39)) then
        tmp = x * t
    else if (x <= (-3d-55)) then
        tmp = t_1
    else if (x <= 4.6d-126) then
        tmp = y * 5.0d0
    else if (x <= 9.5d-84) then
        tmp = x * t
    else if (x <= 1.2d-32) then
        tmp = y * 5.0d0
    else if (x <= 1.4d+103) then
        tmp = x * t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -4e+193) {
		tmp = t_1;
	} else if (x <= -1.4e+39) {
		tmp = x * t;
	} else if (x <= -3e-55) {
		tmp = t_1;
	} else if (x <= 4.6e-126) {
		tmp = y * 5.0;
	} else if (x <= 9.5e-84) {
		tmp = x * t;
	} else if (x <= 1.2e-32) {
		tmp = y * 5.0;
	} else if (x <= 1.4e+103) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -4e+193:
		tmp = t_1
	elif x <= -1.4e+39:
		tmp = x * t
	elif x <= -3e-55:
		tmp = t_1
	elif x <= 4.6e-126:
		tmp = y * 5.0
	elif x <= 9.5e-84:
		tmp = x * t
	elif x <= 1.2e-32:
		tmp = y * 5.0
	elif x <= 1.4e+103:
		tmp = x * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (x <= -4e+193)
		tmp = t_1;
	elseif (x <= -1.4e+39)
		tmp = Float64(x * t);
	elseif (x <= -3e-55)
		tmp = t_1;
	elseif (x <= 4.6e-126)
		tmp = Float64(y * 5.0);
	elseif (x <= 9.5e-84)
		tmp = Float64(x * t);
	elseif (x <= 1.2e-32)
		tmp = Float64(y * 5.0);
	elseif (x <= 1.4e+103)
		tmp = Float64(x * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 2.0 * (x * z);
	tmp = 0.0;
	if (x <= -4e+193)
		tmp = t_1;
	elseif (x <= -1.4e+39)
		tmp = x * t;
	elseif (x <= -3e-55)
		tmp = t_1;
	elseif (x <= 4.6e-126)
		tmp = y * 5.0;
	elseif (x <= 9.5e-84)
		tmp = x * t;
	elseif (x <= 1.2e-32)
		tmp = y * 5.0;
	elseif (x <= 1.4e+103)
		tmp = x * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+193], t$95$1, If[LessEqual[x, -1.4e+39], N[(x * t), $MachinePrecision], If[LessEqual[x, -3e-55], t$95$1, If[LessEqual[x, 4.6e-126], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 9.5e-84], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.2e-32], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.4e+103], N[(x * t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.4 \cdot 10^{+39}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq -3 \cdot 10^{-55}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-84}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+103}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.00000000000000026e193 or -1.40000000000000001e39 < x < -3.00000000000000016e-55 or 1.40000000000000004e103 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Simplified51.0%

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

    if -4.00000000000000026e193 < x < -1.40000000000000001e39 or 4.60000000000000021e-126 < x < 9.49999999999999941e-84 or 1.2000000000000001e-32 < x < 1.40000000000000004e103

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified50.6%

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

    if -3.00000000000000016e-55 < x < 4.60000000000000021e-126 or 9.49999999999999941e-84 < x < 1.2000000000000001e-32

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified72.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+193}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{+39}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-55}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-126}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-84}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-32}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+103}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.65e7

    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. Add Preprocessing
    5. Taylor expanded in t around 0 97.8%

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

    if 2.65e7 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 26500000:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right) + \left(y \cdot 5 + x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 88.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 5 + x \cdot t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1e10 or 9.50000000000000029e-24 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.1e10 < x < 2.4e-195

    1. Initial program 99.9%

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

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

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

    if 2.4e-195 < x < 9.50000000000000029e-24

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto x \cdot \left(\color{blue}{\frac{{\left(y + z\right)}^{2} - {\left(y + z\right)}^{2}}{\left(y + z\right) - \left(y + z\right)}} + t\right) + y \cdot 5 \]
    5. Simplified87.6%

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

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

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

Alternative 7: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 8: 88.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-20} \lor \neg \left(x \leq 2.05 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.49999999999999981e-20 or 2.04999999999999988e-32 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -7.49999999999999981e-20 < x < 2.04999999999999988e-32

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

Alternative 9: 45.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -11000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-126}\right) \land \left(x \leq 1.1 \cdot 10^{-90} \lor \neg \left(x \leq 3.7 \cdot 10^{-23}\right)\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1e10 or 4.60000000000000021e-126 < x < 1.09999999999999993e-90 or 3.7000000000000003e-23 < x

    1. Initial program 100.0%

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

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

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

    if -1.1e10 < x < 4.60000000000000021e-126 or 1.09999999999999993e-90 < x < 3.7000000000000003e-23

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified68.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -11000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-126}\right) \land \left(x \leq 1.1 \cdot 10^{-90} \lor \neg \left(x \leq 3.7 \cdot 10^{-23}\right)\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 77.2% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+109} \lor \neg \left(y \leq 4.2 \cdot 10^{+56}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.9999999999999992e109 or 4.20000000000000034e56 < y

    1. Initial program 99.9%

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

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

    if -8.9999999999999992e109 < y < 4.20000000000000034e56

    1. Initial program 100.0%

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

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

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

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

Alternative 11: 29.9% accurate, 5.0× speedup?

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

\\
x \cdot t
\end{array}
Derivation
  1. Initial program 99.9%

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

    \[\leadsto \color{blue}{t \cdot x} \]
  4. Simplified27.9%

    \[\leadsto \color{blue}{x \cdot t} \]
  5. Final simplification27.9%

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

Reproduce

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