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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.9% accurate, 0.1× speedup?

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

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

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
  2. Step-by-step derivation
    1. fma-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. Final simplification99.9%

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

Alternative 3: 62.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x \leq 4 \cdot 10^{+192} \lor \neg \left(x \leq 2.85 \cdot 10^{+255}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.90000000000000025e-57 or 1.49999999999999996e-19 < x < 4.00000000000000016e192 or 2.84999999999999994e255 < 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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.90000000000000025e-57 < x < 1.49999999999999996e-19

    1. Initial program 99.8%

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

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

    if 4.00000000000000016e192 < x < 2.84999999999999994e255

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{-57}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-19}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+192} \lor \neg \left(x \leq 2.85 \cdot 10^{+255}\right):\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 4: 62.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 4.6 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

\mathbf{elif}\;x \leq 4 \cdot 10^{+192} \lor \neg \left(x \leq 3.2 \cdot 10^{+255}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.4000000000000001e-58 or 4.5999999999999998e-16 < x < 4.00000000000000016e192 or 3.1999999999999998e255 < 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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4000000000000001e-58 < x < 4.5999999999999998e-16

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

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

    if 4.00000000000000016e192 < x < 3.1999999999999998e255

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-58}:\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-16}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+192} \lor \neg \left(x \leq 3.2 \cdot 10^{+255}\right):\\ \;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 5: 86.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \lor \neg \left(y \leq 2.8 \cdot 10^{+24}\right):\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.5 or 2.8000000000000002e24 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -1.5 < y < 2.8000000000000002e24

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 6: 88.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+152} \lor \neg \left(t \leq 5.8 \cdot 10^{+111}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right) + y \cdot 5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.0999999999999999e152 or 5.7999999999999999e111 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -1.0999999999999999e152 < t < 5.7999999999999999e111

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 7: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 8: 61.2% accurate, 1.1× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.15000000000000004e-10 or 3.35e21 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15000000000000004e-10 < z < -5.1999999999999997e-185

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

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

    if -5.1999999999999997e-185 < z < 3.35e21

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

Alternative 9: 82.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+93} \lor \neg \left(y \leq 1.85 \cdot 10^{+71}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.7999999999999997e93 or 1.85e71 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -5.7999999999999997e93 < y < 1.85e71

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 10: 89.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-15} \lor \neg \left(x \leq 5.8 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.49999999999999991e-15 or 5.7999999999999996e-16 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

    if -6.49999999999999991e-15 < x < 5.7999999999999996e-16

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

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

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

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

Alternative 11: 45.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-185}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+44}:\\ \;\;\;\;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 (<= z -1.6e-8)
     t_1
     (if (<= z -2.55e-185) (* y 5.0) (if (<= z 2.5e+44) (* x t) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (z <= -1.6e-8) {
		tmp = t_1;
	} else if (z <= -2.55e-185) {
		tmp = y * 5.0;
	} else if (z <= 2.5e+44) {
		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 (z <= (-1.6d-8)) then
        tmp = t_1
    else if (z <= (-2.55d-185)) then
        tmp = y * 5.0d0
    else if (z <= 2.5d+44) 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 (z <= -1.6e-8) {
		tmp = t_1;
	} else if (z <= -2.55e-185) {
		tmp = y * 5.0;
	} else if (z <= 2.5e+44) {
		tmp = x * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if z <= -1.6e-8:
		tmp = t_1
	elif z <= -2.55e-185:
		tmp = y * 5.0
	elif z <= 2.5e+44:
		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 (z <= -1.6e-8)
		tmp = t_1;
	elseif (z <= -2.55e-185)
		tmp = Float64(y * 5.0);
	elseif (z <= 2.5e+44)
		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 (z <= -1.6e-8)
		tmp = t_1;
	elseif (z <= -2.55e-185)
		tmp = y * 5.0;
	elseif (z <= 2.5e+44)
		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[z, -1.6e-8], t$95$1, If[LessEqual[z, -2.55e-185], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 2.5e+44], N[(x * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.55 \cdot 10^{-185}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;z \leq 2.5 \cdot 10^{+44}:\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.6000000000000001e-8 or 2.4999999999999998e44 < z

    1. Initial program 100.0%

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

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

    if -1.6000000000000001e-8 < z < -2.5500000000000002e-185

    1. Initial program 99.8%

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

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

    if -2.5500000000000002e-185 < z < 2.4999999999999998e44

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-185}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+44}:\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 12: 79.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+44} \lor \neg \left(y \leq 3.7 \cdot 10^{+25}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3e44 or 3.6999999999999999e25 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if -1.3e44 < y < 3.6999999999999999e25

    1. Initial program 100.0%

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

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

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

Alternative 13: 46.5% accurate, 2.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.10000000000000011e-121 or 2.7e-20 < x

    1. Initial program 100.0%

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

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

    if -1.10000000000000011e-121 < x < 2.7e-20

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{-121}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-20}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]

Alternative 14: 29.7% accurate, 5.0× speedup?

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

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

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

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

    \[\leadsto y \cdot 5 \]

Reproduce

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