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

Percentage Accurate: 99.9% → 99.9%
Time: 6.4s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
x \cdot \left(\left(y + \left(z + \left(y + z\right)\right)\right) + t\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. Add Preprocessing
  3. Final simplification99.9%

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

Alternative 2: 47.4% accurate, 0.7× speedup?

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

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

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

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

\mathbf{elif}\;x \leq 2.5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.70000000000000005e234 or 6.9999999999999999e-28 < x < 2.49999999999999995e108

    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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      5. lower-*.f6459.0

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

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Step-by-step derivation
      1. count-2N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
      4. lower-*.f6459.0

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
    7. Applied egg-rr59.0%

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

    if -5.70000000000000005e234 < x < -4.8e-10

    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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} \]
      2. lower-*.f6443.6

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified43.6%

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

    if -4.8e-10 < x < 6.9999999999999999e-28

    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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Step-by-step derivation
      1. lower-*.f6464.8

        \[\leadsto \color{blue}{5 \cdot y} \]
    5. Simplified64.8%

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

    if 2.49999999999999995e108 < 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 inf

      \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(2 \cdot x + 5\right)} \]
      2. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot x + 5\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2 \cdot x\right)\right)} + 5\right) \]
      4. neg-sub0N/A

        \[\leadsto y \cdot \left(\color{blue}{\left(0 - -2 \cdot x\right)} + 5\right) \]
      5. associate--r-N/A

        \[\leadsto y \cdot \color{blue}{\left(0 - \left(-2 \cdot x - 5\right)\right)} \]
      6. neg-sub0N/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-2 \cdot x - 5\right)\right)\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(\left(-2 \cdot x - 5\right)\right)\right)} \]
      8. neg-sub0N/A

        \[\leadsto y \cdot \color{blue}{\left(0 - \left(-2 \cdot x - 5\right)\right)} \]
      9. associate--r-N/A

        \[\leadsto y \cdot \color{blue}{\left(\left(0 - -2 \cdot x\right) + 5\right)} \]
      10. neg-sub0N/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2 \cdot x\right)\right)} + 5\right) \]
      11. distribute-lft-neg-inN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right) \cdot x} + 5\right) \]
      12. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{2} \cdot x + 5\right) \]
      13. *-commutativeN/A

        \[\leadsto y \cdot \left(\color{blue}{x \cdot 2} + 5\right) \]
      14. lower-fma.f6457.0

        \[\leadsto y \cdot \color{blue}{\mathsf{fma}\left(x, 2, 5\right)} \]
    5. Simplified57.0%

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

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

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot y} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(2 \cdot x\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(2 \cdot x\right)} \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(x \cdot 2\right)} \]
      5. lower-*.f6457.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{+234}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;y \cdot 5\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+108}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -22:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 31000000000:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (fma y 2.0 t))))
   (if (<= x -1.3e+244)
     (* x (+ z z))
     (if (<= x -22.0) t_1 (if (<= x 31000000000.0) (fma y 5.0 (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * fma(y, 2.0, t);
	double tmp;
	if (x <= -1.3e+244) {
		tmp = x * (z + z);
	} else if (x <= -22.0) {
		tmp = t_1;
	} else if (x <= 31000000000.0) {
		tmp = fma(y, 5.0, (x * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * fma(y, 2.0, t))
	tmp = 0.0
	if (x <= -1.3e+244)
		tmp = Float64(x * Float64(z + z));
	elseif (x <= -22.0)
		tmp = t_1;
	elseif (x <= 31000000000.0)
		tmp = fma(y, 5.0, Float64(x * t));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e+244], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -22.0], t$95$1, If[LessEqual[x, 31000000000.0], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\
\;\;\;\;x \cdot \left(z + z\right)\\

\mathbf{elif}\;x \leq -22:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 31000000000:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\

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


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

    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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      5. lower-*.f6480.1

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot z\right)} \]
    5. Simplified80.1%

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Step-by-step derivation
      1. count-2N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
      4. lower-*.f6480.1

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
    7. Applied egg-rr80.1%

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

    if -1.3e244 < x < -22 or 3.1e10 < 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
      4. lower-fma.f6469.9

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(y, 2, t\right)} \]
    8. Simplified69.9%

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

    if -22 < x < 3.1e10

    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

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lower-*.f6481.3

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    5. Simplified81.3%

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot t + \color{blue}{y \cdot 5} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot t} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot t \]
      5. lower-fma.f6481.4

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot t\right)} \]
    7. Applied egg-rr81.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -22:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{elif}\;x \leq 31000000000:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 60.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\ \mathbf{if}\;y \leq -9 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-176}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (fma x 2.0 5.0))))
   (if (<= y -9e+20)
     t_1
     (if (<= y 5.4e-176)
       (* x (+ z z))
       (if (<= y 5e+34) (* x (fma y 2.0 t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * fma(x, 2.0, 5.0);
	double tmp;
	if (y <= -9e+20) {
		tmp = t_1;
	} else if (y <= 5.4e-176) {
		tmp = x * (z + z);
	} else if (y <= 5e+34) {
		tmp = x * fma(y, 2.0, t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(y * fma(x, 2.0, 5.0))
	tmp = 0.0
	if (y <= -9e+20)
		tmp = t_1;
	elseif (y <= 5.4e-176)
		tmp = Float64(x * Float64(z + z));
	elseif (y <= 5e+34)
		tmp = Float64(x * fma(y, 2.0, t));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+20], t$95$1, If[LessEqual[y, 5.4e-176], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+34], N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{-176}:\\
\;\;\;\;x \cdot \left(z + z\right)\\

\mathbf{elif}\;y \leq 5 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9e20 or 4.9999999999999998e34 < 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

      \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(2 \cdot x + 5\right)} \]
      2. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot x + 5\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2 \cdot x\right)\right)} + 5\right) \]
      4. neg-sub0N/A

        \[\leadsto y \cdot \left(\color{blue}{\left(0 - -2 \cdot x\right)} + 5\right) \]
      5. associate--r-N/A

        \[\leadsto y \cdot \color{blue}{\left(0 - \left(-2 \cdot x - 5\right)\right)} \]
      6. neg-sub0N/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-2 \cdot x - 5\right)\right)\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(\left(-2 \cdot x - 5\right)\right)\right)} \]
      8. neg-sub0N/A

        \[\leadsto y \cdot \color{blue}{\left(0 - \left(-2 \cdot x - 5\right)\right)} \]
      9. associate--r-N/A

        \[\leadsto y \cdot \color{blue}{\left(\left(0 - -2 \cdot x\right) + 5\right)} \]
      10. neg-sub0N/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2 \cdot x\right)\right)} + 5\right) \]
      11. distribute-lft-neg-inN/A

        \[\leadsto y \cdot \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right) \cdot x} + 5\right) \]
      12. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{2} \cdot x + 5\right) \]
      13. *-commutativeN/A

        \[\leadsto y \cdot \left(\color{blue}{x \cdot 2} + 5\right) \]
      14. lower-fma.f6484.2

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

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

    if -9e20 < y < 5.3999999999999997e-176

    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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      5. lower-*.f6453.2

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

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Step-by-step derivation
      1. count-2N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      3. *-commutativeN/A

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

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
    7. Applied egg-rr53.2%

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

    if 5.3999999999999997e-176 < y < 4.9999999999999998e34

    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 inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
      4. lower-fma.f6463.0

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(y, 2, t\right)} \]
    8. Simplified63.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+20}:\\ \;\;\;\;y \cdot \mathsf{fma}\left(x, 2, 5\right)\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-176}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+34}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \mathsf{fma}\left(x, 2, 5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 60.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-10}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (fma y 2.0 t))))
   (if (<= x -1.3e+244)
     (* x (+ z z))
     (if (<= x -4.8e-10) t_1 (if (<= x 7e-28) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * fma(y, 2.0, t);
	double tmp;
	if (x <= -1.3e+244) {
		tmp = x * (z + z);
	} else if (x <= -4.8e-10) {
		tmp = t_1;
	} else if (x <= 7e-28) {
		tmp = y * 5.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * fma(y, 2.0, t))
	tmp = 0.0
	if (x <= -1.3e+244)
		tmp = Float64(x * Float64(z + z));
	elseif (x <= -4.8e-10)
		tmp = t_1;
	elseif (x <= 7e-28)
		tmp = Float64(y * 5.0);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e+244], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-10], t$95$1, If[LessEqual[x, 7e-28], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\
\;\;\;\;x \cdot \left(z + z\right)\\

\mathbf{elif}\;x \leq -4.8 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\

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

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


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

    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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      5. lower-*.f6480.1

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot z\right)} \]
    5. Simplified80.1%

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Step-by-step derivation
      1. count-2N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
      4. lower-*.f6480.1

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
    7. Applied egg-rr80.1%

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

    if -1.3e244 < x < -4.8e-10 or 6.9999999999999999e-28 < 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + 2 \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(2 \cdot y + t\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(\color{blue}{y \cdot 2} + t\right) \]
      4. lower-fma.f6468.2

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(y, 2, t\right)} \]
    8. Simplified68.2%

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

    if -4.8e-10 < x < 6.9999999999999999e-28

    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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Step-by-step derivation
      1. lower-*.f6464.8

        \[\leadsto \color{blue}{5 \cdot y} \]
    5. Simplified64.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+244}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\ \mathbf{if}\;x \leq -22:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.5:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (fma 2.0 (+ y z) t))))
   (if (<= x -22.0) t_1 (if (<= x 2.5) (fma y 5.0 (* x (+ t (+ z z)))) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * fma(2.0, (y + z), t);
	double tmp;
	if (x <= -22.0) {
		tmp = t_1;
	} else if (x <= 2.5) {
		tmp = fma(y, 5.0, (x * (t + (z + z))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * fma(2.0, Float64(y + z), t))
	tmp = 0.0
	if (x <= -22.0)
		tmp = t_1;
	elseif (x <= 2.5)
		tmp = fma(y, 5.0, Float64(x * Float64(t + Float64(z + z))));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -22.0], t$95$1, If[LessEqual[x, 2.5], N[(y * 5.0 + N[(x * N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -22:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -22 or 2.5 < 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

    if -22 < x < 2.5

    1. Initial program 99.9%

      \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto x \cdot \left(\left(\left(\color{blue}{\left(y + z\right)} + z\right) + y\right) + t\right) + y \cdot 5 \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \left(\left(\color{blue}{\left(\left(y + z\right) + z\right)} + y\right) + t\right) + y \cdot 5 \]
      3. lift-+.f64N/A

        \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(y + z\right) + z\right) + y\right)} + t\right) + y \cdot 5 \]
      4. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)} + y \cdot 5 \]
      5. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)} + y \cdot 5 \]
      6. lift-*.f64N/A

        \[\leadsto x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + \color{blue}{y \cdot 5} \]
      7. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) \]
      9. lower-fma.f64100.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)} \]
    4. Applied egg-rr99.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -22:\\ \;\;\;\;x \cdot \mathsf{fma}\left(2, y + z, t\right)\\ \mathbf{elif}\;x \leq 2.5:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(2, y + z, t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 47.7% accurate, 1.0× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.70000000000000005e234 or 6.9999999999999999e-28 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(2 \cdot x\right) \cdot z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot z \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
      5. lower-*.f6447.6

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

      \[\leadsto \color{blue}{x \cdot \left(2 \cdot z\right)} \]
    6. Step-by-step derivation
      1. count-2N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      2. lift-+.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(z + z\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
      4. lower-*.f6447.6

        \[\leadsto \color{blue}{\left(z + z\right) \cdot x} \]
    7. Applied egg-rr47.6%

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

    if -5.70000000000000005e234 < x < -4.8e-10

    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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} \]
      2. lower-*.f6443.6

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified43.6%

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

    if -4.8e-10 < x < 6.9999999999999999e-28

    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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Step-by-step derivation
      1. lower-*.f6464.8

        \[\leadsto \color{blue}{5 \cdot y} \]
    5. Simplified64.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{+234}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 88.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\ \mathbf{if}\;x \leq -22:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (fma 2.0 (+ y z) t))))
   (if (<= x -22.0) t_1 (if (<= x 7e-28) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * fma(2.0, (y + z), t);
	double tmp;
	if (x <= -22.0) {
		tmp = t_1;
	} else if (x <= 7e-28) {
		tmp = fma(y, 5.0, (x * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * fma(2.0, Float64(y + z), t))
	tmp = 0.0
	if (x <= -22.0)
		tmp = t_1;
	elseif (x <= 7e-28)
		tmp = fma(y, 5.0, Float64(x * t));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -22.0], t$95$1, If[LessEqual[x, 7e-28], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -22:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -22 or 6.9999999999999999e-28 < 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

    if -22 < x < 6.9999999999999999e-28

    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

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lower-*.f6484.0

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

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot t + \color{blue}{y \cdot 5} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot t} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot t \]
      5. lower-fma.f6484.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot t\right)} \]
    7. Applied egg-rr84.0%

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

Alternative 9: 74.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{if}\;x \leq -7000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 910000000:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (* (+ y z) 2.0))))
   (if (<= x -7000.0) t_1 (if (<= x 910000000.0) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y + z) * 2.0);
	double tmp;
	if (x <= -7000.0) {
		tmp = t_1;
	} else if (x <= 910000000.0) {
		tmp = fma(y, 5.0, (x * t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y + z) * 2.0))
	tmp = 0.0
	if (x <= -7000.0)
		tmp = t_1;
	elseif (x <= 910000000.0)
		tmp = fma(y, 5.0, Float64(x * t));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7000.0], t$95$1, If[LessEqual[x, 910000000.0], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 910000000:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7e3 or 9.1e8 < 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \left(t + \left(2 \cdot y + 2 \cdot z\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \color{blue}{\left(\left(2 \cdot y + 2 \cdot z\right) + t\right)} \]
      3. distribute-lft-outN/A

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot \left(y + z\right)} + t\right) \]
      4. lower-fma.f64N/A

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(2 \cdot \left(y + z\right)\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

    if -7e3 < x < 9.1e8

    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

      \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lower-*.f6482.5

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

      \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{x \cdot t} + y \cdot 5 \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot t + \color{blue}{y \cdot 5} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot 5 + x \cdot t} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{y \cdot 5} + x \cdot t \]
      5. lower-fma.f6482.6

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot t\right)} \]
    7. Applied egg-rr82.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7000:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \mathbf{elif}\;x \leq 910000000:\\ \;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\left(y + z\right) \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 46.6% accurate, 1.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.8e-10 or 6.9999999999999999e-28 < x

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{t \cdot x} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{x \cdot t} \]
      2. lower-*.f6435.7

        \[\leadsto \color{blue}{x \cdot t} \]
    5. Simplified35.7%

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

    if -4.8e-10 < x < 6.9999999999999999e-28

    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

      \[\leadsto \color{blue}{5 \cdot y} \]
    4. Step-by-step derivation
      1. lower-*.f6464.8

        \[\leadsto \color{blue}{5 \cdot y} \]
    5. Simplified64.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-28}:\\ \;\;\;\;y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 29.8% accurate, 4.3× 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

    \[\leadsto \color{blue}{5 \cdot y} \]
  4. Step-by-step derivation
    1. lower-*.f6432.9

      \[\leadsto \color{blue}{5 \cdot y} \]
  5. Simplified32.9%

    \[\leadsto \color{blue}{5 \cdot y} \]
  6. Final simplification32.9%

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

Reproduce

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