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

Percentage Accurate: 99.8% → 99.8%
Time: 12.4s
Alternatives: 19
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 19 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.8% 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.1× speedup?

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

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

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

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

Alternative 2: 56.7% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t \leq -1.5 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -6 \cdot 10^{-207}:\\
\;\;\;\;y \cdot \left(x + 5\right)\\

\mathbf{elif}\;t \leq 1.7 \cdot 10^{-199}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 4.5 \cdot 10^{-173}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 3.4 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.32e100 or 3.4000000000000001e58 < 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. Add Preprocessing
    3. Taylor expanded in t around inf 69.1%

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified69.1%

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

    if -1.32e100 < t < -1.5e29 or -5.9999999999999999e-207 < t < 1.70000000000000003e-199 or 4.50000000000000018e-173 < t < 3.4000000000000001e58

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot \left(y + z\right)\right)} \]
      9. distribute-lft-out67.9%

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} \]
      11. distribute-lft-out67.9%

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

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

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

    if -1.5e29 < t < -5.9999999999999999e-207

    1. Initial program 100.0%

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

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

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

    if 1.70000000000000003e-199 < t < 4.50000000000000018e-173

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.32 \cdot 10^{+100}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq -1.5 \cdot 10^{+29}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-207}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;t \leq 1.7 \cdot 10^{-199}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{-173}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+58}:\\ \;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 44.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+39}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;t \leq 10^{-301}:\\
\;\;\;\;y \cdot 5\\

\mathbf{elif}\;t \leq 1.15 \cdot 10^{-259}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\

\mathbf{elif}\;t \leq 1.15 \cdot 10^{-140}:\\
\;\;\;\;y \cdot 5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -5.2e39 or 4.7000000000000003e57 < t

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified65.8%

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

    if -5.2e39 < t < 1.00000000000000007e-301 or 1.15e-259 < t < 1.1500000000000001e-140

    1. Initial program 99.9%

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

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

    if 1.00000000000000007e-301 < t < 1.15e-259

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 1.1500000000000001e-140 < t < 4.7000000000000003e57

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.2 \cdot 10^{+39}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 10^{-301}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-259}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-140}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;t \leq 4.7 \cdot 10^{+57}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-9} \lor \neg \left(x \leq 2.4 \cdot 10^{-23}\right):\\
\;\;\;\;x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{x}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.65000000000000009e-9 or 2.39999999999999996e-23 < x

    1. Initial program 100.0%

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

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

    if -1.65000000000000009e-9 < x < 2.39999999999999996e-23

    1. Initial program 99.9%

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

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

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

Alternative 5: 99.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -34000000000000 \lor \neg \left(x \leq 6.2 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.4e13 or 6.1999999999999999e-6 < 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 99.1%

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

    if -3.4e13 < x < 6.1999999999999999e-6

    1. Initial program 99.9%

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

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

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

Alternative 6: 79.6% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.5e27 or 3.09999999999999999e122 < 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.1%

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

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

    if -8.5e27 < y < 7.6e6

    1. Initial program 100.0%

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

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

    if 7.6e6 < y < 3.09999999999999999e122

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+27}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{elif}\;y \leq 7600000:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+122}:\\ \;\;\;\;y \cdot 5 + x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-81} \lor \neg \left(y \leq 4200000\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.3999999999999999e-81 or 4.2e6 < 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 0 95.4%

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

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

    if -3.3999999999999999e-81 < y < 4.2e6

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

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

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

Alternative 8: 86.3% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.9999999999999999e-81 or 1.8e8 < 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 93.3%

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

    if -1.9999999999999999e-81 < y < 1.8e8

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

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

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

Alternative 9: 89.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+92} \lor \neg \left(t \leq 1.45 \cdot 10^{+57}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.50000000000000007e92 or 1.4500000000000001e57 < t

    1. Initial program 99.9%

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

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

    if -1.50000000000000007e92 < t < 1.4500000000000001e57

    1. Initial program 99.9%

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

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

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

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

Alternative 10: 44.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+39}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;t \leq 5.2 \cdot 10^{-145}:\\
\;\;\;\;y \cdot 5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.4000000000000001e39 or 3.79999999999999997e53 < t

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified65.8%

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

    if -2.4000000000000001e39 < t < 5.1999999999999999e-145

    1. Initial program 99.9%

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

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

    if 5.1999999999999999e-145 < t < 3.79999999999999997e53

    1. Initial program 100.0%

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

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

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

Alternative 11: 50.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+30}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;t \leq 1.75 \cdot 10^{-137}:\\
\;\;\;\;y \cdot \left(x + 5\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.50000000000000021e30 or 4.49999999999999998e55 < t

    1. Initial program 99.9%

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

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

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

    if -3.50000000000000021e30 < t < 1.7500000000000001e-137

    1. Initial program 99.9%

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

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

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

    if 1.7500000000000001e-137 < t < 4.49999999999999998e55

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+30}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-137}:\\ \;\;\;\;y \cdot \left(x + 5\right)\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+55}:\\ \;\;\;\;2 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 87.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \cdot 10^{-67} \lor \neg \left(x \leq 8.2 \cdot 10^{-82}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.18e-67 or 8.19999999999999992e-82 < 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 93.8%

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

    if -1.18e-67 < x < 8.19999999999999992e-82

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

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

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

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

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

Alternative 13: 75.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+63} \lor \neg \left(y \leq 1.1 \cdot 10^{+41}\right):\\
\;\;\;\;y \cdot \left(x + 5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35000000000000009e63 or 1.09999999999999995e41 < 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 0 86.5%

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

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

    if -1.35000000000000009e63 < y < 1.09999999999999995e41

    1. Initial program 100.0%

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

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

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

Alternative 14: 79.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+27} \lor \neg \left(y \leq 1.4 \cdot 10^{+41}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.60000000000000043e27 or 1.4e41 < 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 84.7%

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

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

    if -7.60000000000000043e27 < y < 1.4e41

    1. Initial program 100.0%

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

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

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

Alternative 15: 61.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

    if -2.5999999999999999e-52 < x < 2.1999999999999999e-84

    1. Initial program 99.9%

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

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

    if 2.1999999999999999e-84 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(2 \cdot y + 2 \cdot z\right) \cdot x} \]
      11. distribute-lft-out67.7%

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

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

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

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

Alternative 16: 96.7% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 17: 99.8% 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.9%

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

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

Alternative 18: 43.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{+39} \lor \neg \left(t \leq 5.8 \cdot 10^{+26}\right):\\
\;\;\;\;x \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.02e39 or 5.8e26 < t

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Simplified64.5%

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

    if -1.02e39 < t < 5.8e26

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.02 \cdot 10^{+39} \lor \neg \left(t \leq 5.8 \cdot 10^{+26}\right):\\ \;\;\;\;x \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot 5\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 29.1% 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. Add Preprocessing
  3. Taylor expanded in x around 0 30.3%

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

    \[\leadsto y \cdot 5 \]
  5. Add Preprocessing

Reproduce

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