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

Percentage Accurate: 99.9% → 99.8%
Time: 10.4s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.6× speedup?

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

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

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

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


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

    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-define99.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 x around inf 100.0%

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

    if -0.00350000000000000007 < x < 3.0000000000000001e143

    1. Initial program 99.2%

      \[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-define99.2%

        \[\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.2%

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

        \[\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.2%

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

      \[\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 99.9%

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

    if 3.0000000000000001e143 < 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-define100.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 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 2: 99.9% accurate, 0.1× speedup?

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

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

    \[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-define99.5%

      \[\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.6%

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

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

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

Alternative 3: 99.9% accurate, 0.1× speedup?

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

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

    \[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-define99.5%

      \[\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.5%

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

      \[\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.5%

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

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

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

Alternative 4: 47.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -6 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-33}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.1 \cdot 10^{-61}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+86}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+202}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+231}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \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 -6e+92)
     t_1
     (if (<= x -1.4e-33)
       (* x t)
       (if (<= x 6.1e-61)
         (* y 5.0)
         (if (<= x 4.5e+86)
           (* x t)
           (if (<= x 3.8e+202)
             t_1
             (if (<= x 6.5e+231) (* y (* x 2.0)) (* x t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -6e+92) {
		tmp = t_1;
	} else if (x <= -1.4e-33) {
		tmp = x * t;
	} else if (x <= 6.1e-61) {
		tmp = y * 5.0;
	} else if (x <= 4.5e+86) {
		tmp = x * t;
	} else if (x <= 3.8e+202) {
		tmp = t_1;
	} else if (x <= 6.5e+231) {
		tmp = y * (x * 2.0);
	} else {
		tmp = x * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 2.0d0 * (x * z)
    if (x <= (-6d+92)) then
        tmp = t_1
    else if (x <= (-1.4d-33)) then
        tmp = x * t
    else if (x <= 6.1d-61) then
        tmp = y * 5.0d0
    else if (x <= 4.5d+86) then
        tmp = x * t
    else if (x <= 3.8d+202) then
        tmp = t_1
    else if (x <= 6.5d+231) then
        tmp = y * (x * 2.0d0)
    else
        tmp = x * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -6e+92) {
		tmp = t_1;
	} else if (x <= -1.4e-33) {
		tmp = x * t;
	} else if (x <= 6.1e-61) {
		tmp = y * 5.0;
	} else if (x <= 4.5e+86) {
		tmp = x * t;
	} else if (x <= 3.8e+202) {
		tmp = t_1;
	} else if (x <= 6.5e+231) {
		tmp = y * (x * 2.0);
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -6e+92:
		tmp = t_1
	elif x <= -1.4e-33:
		tmp = x * t
	elif x <= 6.1e-61:
		tmp = y * 5.0
	elif x <= 4.5e+86:
		tmp = x * t
	elif x <= 3.8e+202:
		tmp = t_1
	elif x <= 6.5e+231:
		tmp = y * (x * 2.0)
	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 <= -6e+92)
		tmp = t_1;
	elseif (x <= -1.4e-33)
		tmp = Float64(x * t);
	elseif (x <= 6.1e-61)
		tmp = Float64(y * 5.0);
	elseif (x <= 4.5e+86)
		tmp = Float64(x * t);
	elseif (x <= 3.8e+202)
		tmp = t_1;
	elseif (x <= 6.5e+231)
		tmp = Float64(y * Float64(x * 2.0));
	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 <= -6e+92)
		tmp = t_1;
	elseif (x <= -1.4e-33)
		tmp = x * t;
	elseif (x <= 6.1e-61)
		tmp = y * 5.0;
	elseif (x <= 4.5e+86)
		tmp = x * t;
	elseif (x <= 3.8e+202)
		tmp = t_1;
	elseif (x <= 6.5e+231)
		tmp = y * (x * 2.0);
	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, -6e+92], t$95$1, If[LessEqual[x, -1.4e-33], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.1e-61], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 4.5e+86], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.8e+202], t$95$1, If[LessEqual[x, 6.5e+231], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;x \leq 4.5 \cdot 10^{+86}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 3.8 \cdot 10^{+202}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{+231}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.00000000000000026e92 or 4.49999999999999993e86 < x < 3.8000000000000001e202

    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-define99.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 91.7%

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

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

    if -6.00000000000000026e92 < x < -1.4e-33 or 6.1000000000000001e-61 < x < 4.49999999999999993e86 or 6.49999999999999933e231 < 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-define100.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 t around 0 92.3%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative53.0%

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified53.0%

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

    if -1.4e-33 < x < 6.1000000000000001e-61

    1. Initial program 98.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 66.1%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified66.1%

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

    if 3.8000000000000001e202 < x < 6.49999999999999933e231

    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-define100.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)} \]
    6. Taylor expanded in y around inf 80.7%

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

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

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

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

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

Alternative 5: 47.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -5.6 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-34}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-61}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+86} \lor \neg \left(x \leq 5 \cdot 10^{+171}\right):\\ \;\;\;\;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 -5.6e+92)
     t_1
     (if (<= x -7.2e-34)
       (* x t)
       (if (<= x 6.2e-61)
         (* y 5.0)
         (if (or (<= x 3.5e+86) (not (<= x 5e+171))) (* 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 <= -5.6e+92) {
		tmp = t_1;
	} else if (x <= -7.2e-34) {
		tmp = x * t;
	} else if (x <= 6.2e-61) {
		tmp = y * 5.0;
	} else if ((x <= 3.5e+86) || !(x <= 5e+171)) {
		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 <= (-5.6d+92)) then
        tmp = t_1
    else if (x <= (-7.2d-34)) then
        tmp = x * t
    else if (x <= 6.2d-61) then
        tmp = y * 5.0d0
    else if ((x <= 3.5d+86) .or. (.not. (x <= 5d+171))) 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 <= -5.6e+92) {
		tmp = t_1;
	} else if (x <= -7.2e-34) {
		tmp = x * t;
	} else if (x <= 6.2e-61) {
		tmp = y * 5.0;
	} else if ((x <= 3.5e+86) || !(x <= 5e+171)) {
		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 <= -5.6e+92:
		tmp = t_1
	elif x <= -7.2e-34:
		tmp = x * t
	elif x <= 6.2e-61:
		tmp = y * 5.0
	elif (x <= 3.5e+86) or not (x <= 5e+171):
		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 <= -5.6e+92)
		tmp = t_1;
	elseif (x <= -7.2e-34)
		tmp = Float64(x * t);
	elseif (x <= 6.2e-61)
		tmp = Float64(y * 5.0);
	elseif ((x <= 3.5e+86) || !(x <= 5e+171))
		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 <= -5.6e+92)
		tmp = t_1;
	elseif (x <= -7.2e-34)
		tmp = x * t;
	elseif (x <= 6.2e-61)
		tmp = y * 5.0;
	elseif ((x <= 3.5e+86) || ~((x <= 5e+171)))
		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, -5.6e+92], t$95$1, If[LessEqual[x, -7.2e-34], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.2e-61], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 3.5e+86], N[Not[LessEqual[x, 5e+171]], $MachinePrecision]], 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 -5.6 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{-34}:\\
\;\;\;\;x \cdot t\\

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

\mathbf{elif}\;x \leq 3.5 \cdot 10^{+86} \lor \neg \left(x \leq 5 \cdot 10^{+171}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.60000000000000001e92 or 3.50000000000000019e86 < x < 5.0000000000000004e171

    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-define99.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 91.0%

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

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

    if -5.60000000000000001e92 < x < -7.20000000000000016e-34 or 6.1999999999999999e-61 < x < 3.50000000000000019e86 or 5.0000000000000004e171 < 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-define100.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 t around 0 93.5%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative50.2%

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified50.2%

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

    if -7.20000000000000016e-34 < x < 6.1999999999999999e-61

    1. Initial program 98.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 66.1%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified66.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{+92}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-34}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-61}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+86} \lor \neg \left(x \leq 5 \cdot 10^{+171}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+127} \lor \neg \left(y \leq -2.8 \cdot 10^{+30} \lor \neg \left(y \leq -6.8 \cdot 10^{-51}\right) \land y \leq 1.3 \cdot 10^{+85}\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 -2.5e+127)
         (not (or (<= y -2.8e+30) (and (not (<= y -6.8e-51)) (<= y 1.3e+85)))))
   (* 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 <= -2.5e+127) || !((y <= -2.8e+30) || (!(y <= -6.8e-51) && (y <= 1.3e+85)))) {
		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 <= (-2.5d+127)) .or. (.not. (y <= (-2.8d+30)) .or. (.not. (y <= (-6.8d-51))) .and. (y <= 1.3d+85))) 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 <= -2.5e+127) || !((y <= -2.8e+30) || (!(y <= -6.8e-51) && (y <= 1.3e+85)))) {
		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 <= -2.5e+127) or not ((y <= -2.8e+30) or (not (y <= -6.8e-51) and (y <= 1.3e+85))):
		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 <= -2.5e+127) || !((y <= -2.8e+30) || (!(y <= -6.8e-51) && (y <= 1.3e+85))))
		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 <= -2.5e+127) || ~(((y <= -2.8e+30) || (~((y <= -6.8e-51)) && (y <= 1.3e+85)))))
		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, -2.5e+127], N[Not[Or[LessEqual[y, -2.8e+30], And[N[Not[LessEqual[y, -6.8e-51]], $MachinePrecision], LessEqual[y, 1.3e+85]]]], $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 -2.5 \cdot 10^{+127} \lor \neg \left(y \leq -2.8 \cdot 10^{+30} \lor \neg \left(y \leq -6.8 \cdot 10^{-51}\right) \land y \leq 1.3 \cdot 10^{+85}\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 < -2.5000000000000002e127 or -2.79999999999999983e30 < y < -6.80000000000000005e-51 or 1.30000000000000005e85 < y

    1. Initial program 99.9%

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

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

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

    if -2.5000000000000002e127 < y < -2.79999999999999983e30 or -6.80000000000000005e-51 < y < 1.30000000000000005e85

    1. Initial program 99.3%

      \[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-define99.3%

        \[\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.3%

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

        \[\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.3%

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

      \[\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 96.7%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    7. Step-by-step derivation
      1. +-commutative81.6%

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

        \[\leadsto \color{blue}{x \cdot t} + 2 \cdot \left(x \cdot z\right) \]
      3. *-commutative81.6%

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

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

        \[\leadsto x \cdot t + x \cdot \color{blue}{\left(2 \cdot z\right)} \]
      6. distribute-lft-in83.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{+127} \lor \neg \left(y \leq -2.8 \cdot 10^{+30} \lor \neg \left(y \leq -6.8 \cdot 10^{-51}\right) \land y \leq 1.3 \cdot 10^{+85}\right):\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + z \cdot 2\right)\\ \mathbf{if}\;x \leq -6.2 \cdot 10^{-77}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{-62}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+203} \lor \neg \left(x \leq 6.4 \cdot 10^{+274}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* z 2.0)))))
   (if (<= x -6.2e-77)
     t_1
     (if (<= x 7.4e-62)
       (* y 5.0)
       (if (or (<= x 5.6e+203) (not (<= x 6.4e+274)))
         t_1
         (* x (+ t (* y 2.0))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (z * 2.0));
	double tmp;
	if (x <= -6.2e-77) {
		tmp = t_1;
	} else if (x <= 7.4e-62) {
		tmp = y * 5.0;
	} else if ((x <= 5.6e+203) || !(x <= 6.4e+274)) {
		tmp = t_1;
	} else {
		tmp = x * (t + (y * 2.0));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * (t + (z * 2.0d0))
    if (x <= (-6.2d-77)) then
        tmp = t_1
    else if (x <= 7.4d-62) then
        tmp = y * 5.0d0
    else if ((x <= 5.6d+203) .or. (.not. (x <= 6.4d+274))) then
        tmp = t_1
    else
        tmp = x * (t + (y * 2.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 tmp;
	if (x <= -6.2e-77) {
		tmp = t_1;
	} else if (x <= 7.4e-62) {
		tmp = y * 5.0;
	} else if ((x <= 5.6e+203) || !(x <= 6.4e+274)) {
		tmp = t_1;
	} else {
		tmp = x * (t + (y * 2.0));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (z * 2.0))
	tmp = 0
	if x <= -6.2e-77:
		tmp = t_1
	elif x <= 7.4e-62:
		tmp = y * 5.0
	elif (x <= 5.6e+203) or not (x <= 6.4e+274):
		tmp = t_1
	else:
		tmp = x * (t + (y * 2.0))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(z * 2.0)))
	tmp = 0.0
	if (x <= -6.2e-77)
		tmp = t_1;
	elseif (x <= 7.4e-62)
		tmp = Float64(y * 5.0);
	elseif ((x <= 5.6e+203) || !(x <= 6.4e+274))
		tmp = t_1;
	else
		tmp = Float64(x * Float64(t + Float64(y * 2.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (z * 2.0));
	tmp = 0.0;
	if (x <= -6.2e-77)
		tmp = t_1;
	elseif (x <= 7.4e-62)
		tmp = y * 5.0;
	elseif ((x <= 5.6e+203) || ~((x <= 6.4e+274)))
		tmp = t_1;
	else
		tmp = x * (t + (y * 2.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]}, If[LessEqual[x, -6.2e-77], t$95$1, If[LessEqual[x, 7.4e-62], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 5.6e+203], N[Not[LessEqual[x, 6.4e+274]], $MachinePrecision]], t$95$1, N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+203} \lor \neg \left(x \leq 6.4 \cdot 10^{+274}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.20000000000000016e-77 or 7.3999999999999996e-62 < x < 5.5999999999999998e203 or 6.39999999999999965e274 < x

    1. Initial program 99.3%

      \[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-define99.3%

        \[\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.3%

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

        \[\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.3%

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

      \[\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 93.3%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    7. Step-by-step derivation
      1. +-commutative69.9%

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

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

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

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

        \[\leadsto x \cdot t + x \cdot \color{blue}{\left(2 \cdot z\right)} \]
      6. distribute-lft-in73.3%

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

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

    if -6.20000000000000016e-77 < x < 7.3999999999999996e-62

    1. Initial program 99.8%

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

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

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

    if 5.5999999999999998e203 < x < 6.39999999999999965e274

    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-define100.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)} \]
    6. Taylor expanded in z around 0 85.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-77}:\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{elif}\;x \leq 7.4 \cdot 10^{-62}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+203} \lor \neg \left(x \leq 6.4 \cdot 10^{+274}\right):\\ \;\;\;\;x \cdot \left(t + z \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 63.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(t + y \cdot 2\right)\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+114}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+95}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-35} \lor \neg \left(x \leq 3.3 \cdot 10^{-62}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ t (* y 2.0)))))
   (if (<= x -9.5e+114)
     t_1
     (if (<= x -1.6e+95)
       (* 2.0 (* x z))
       (if (or (<= x -2e-35) (not (<= x 3.3e-62))) t_1 (* y 5.0))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (y * 2.0));
	double tmp;
	if (x <= -9.5e+114) {
		tmp = t_1;
	} else if (x <= -1.6e+95) {
		tmp = 2.0 * (x * z);
	} else if ((x <= -2e-35) || !(x <= 3.3e-62)) {
		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) :: tmp
    t_1 = x * (t + (y * 2.0d0))
    if (x <= (-9.5d+114)) then
        tmp = t_1
    else if (x <= (-1.6d+95)) then
        tmp = 2.0d0 * (x * z)
    else if ((x <= (-2d-35)) .or. (.not. (x <= 3.3d-62))) 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 + (y * 2.0));
	double tmp;
	if (x <= -9.5e+114) {
		tmp = t_1;
	} else if (x <= -1.6e+95) {
		tmp = 2.0 * (x * z);
	} else if ((x <= -2e-35) || !(x <= 3.3e-62)) {
		tmp = t_1;
	} else {
		tmp = y * 5.0;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (y * 2.0))
	tmp = 0
	if x <= -9.5e+114:
		tmp = t_1
	elif x <= -1.6e+95:
		tmp = 2.0 * (x * z)
	elif (x <= -2e-35) or not (x <= 3.3e-62):
		tmp = t_1
	else:
		tmp = y * 5.0
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(y * 2.0)))
	tmp = 0.0
	if (x <= -9.5e+114)
		tmp = t_1;
	elseif (x <= -1.6e+95)
		tmp = Float64(2.0 * Float64(x * z));
	elseif ((x <= -2e-35) || !(x <= 3.3e-62))
		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 + (y * 2.0));
	tmp = 0.0;
	if (x <= -9.5e+114)
		tmp = t_1;
	elseif (x <= -1.6e+95)
		tmp = 2.0 * (x * z);
	elseif ((x <= -2e-35) || ~((x <= 3.3e-62)))
		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[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+114], t$95$1, If[LessEqual[x, -1.6e+95], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2e-35], N[Not[LessEqual[x, 3.3e-62]], $MachinePrecision]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-35} \lor \neg \left(x \leq 3.3 \cdot 10^{-62}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.5000000000000001e114 or -1.6e95 < x < -2.00000000000000002e-35 or 3.30000000000000004e-62 < 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-define100.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 95.6%

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

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

    if -9.5000000000000001e114 < x < -1.6e95

    1. Initial program 99.8%

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

        \[\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.8%

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

        \[\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.8%

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

      \[\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 100.0%

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

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

    if -2.00000000000000002e-35 < x < 3.30000000000000004e-62

    1. Initial program 98.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 66.1%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified66.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+114}:\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{+95}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-35} \lor \neg \left(x \leq 3.3 \cdot 10^{-62}\right):\\ \;\;\;\;x \cdot \left(t + y \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 94.0% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.2000000000000006e205

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

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

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

    if -8.2000000000000006e205 < y < 5.1999999999999996e68

    1. Initial program 99.4%

      \[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-define99.4%

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

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

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

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

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

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

    if 5.1999999999999996e68 < 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-define99.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 91.0%

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

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

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

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

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

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

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

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

Alternative 10: 88.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.65 \cdot 10^{-8} \lor \neg \left(x \leq 2.75 \cdot 10^{-33}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.6499999999999999e-8 or 2.75e-33 < 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. Step-by-step derivation
      1. fma-define99.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 x around inf 98.7%

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

    if -2.6499999999999999e-8 < x < 2.75e-33

    1. Initial program 99.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-define99.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+99.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\left(y + z\right) + \left(z + y\right)\right)} + t, y \cdot 5\right) \]
      3. +-commutative99.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-299.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{2 \cdot \left(y + z\right)} + t, y \cdot 5\right) \]
    3. Simplified99.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 t around 0 99.9%

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

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

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

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

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

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

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

Alternative 11: 77.9% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.1999999999999999e133 or 2.1000000000000001e85 < 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 90.8%

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

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

    if -1.1999999999999999e133 < y < -5.0000000000000002e-57

    1. Initial program 97.1%

      \[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.9%

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

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

    if -5.0000000000000002e-57 < y < 2.1000000000000001e85

    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-define99.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)} \]
    6. Taylor expanded in y around 0 82.4%

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right) + t \cdot x} \]
    7. Step-by-step derivation
      1. +-commutative82.4%

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

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

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

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

        \[\leadsto x \cdot t + x \cdot \color{blue}{\left(2 \cdot z\right)} \]
      6. distribute-lft-in84.6%

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

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

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

Alternative 12: 88.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-18} \lor \neg \left(x \leq 2.55 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.6e-18 or 2.55e-37 < 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. Step-by-step derivation
      1. fma-define99.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 x around inf 98.0%

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

    if -1.6e-18 < x < 2.55e-37

    1. Initial program 99.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 84.6%

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

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

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

Alternative 13: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 14: 47.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-34} \lor \neg \left(x \leq 6.4 \cdot 10^{-62}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.60000000000000001e-34 or 6.40000000000000043e-62 < 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-define100.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 t around 0 92.5%

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

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

        \[\leadsto \color{blue}{x \cdot t} \]
    8. Simplified39.6%

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

    if -1.60000000000000001e-34 < x < 6.40000000000000043e-62

    1. Initial program 98.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 66.1%

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Simplified66.1%

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

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

Alternative 15: 30.2% 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.5%

    \[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-define99.5%

      \[\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.5%

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

      \[\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.5%

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

    \[\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 95.2%

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

    \[\leadsto \color{blue}{t \cdot x} \]
  7. Step-by-step derivation
    1. *-commutative32.1%

      \[\leadsto \color{blue}{x \cdot t} \]
  8. Simplified32.1%

    \[\leadsto \color{blue}{x \cdot t} \]
  9. Add Preprocessing

Reproduce

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