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

Percentage Accurate: 99.9% → 100.0%
Time: 14.5s
Alternatives: 11
Speedup: 1.2×

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: 100.0% accurate, 0.1× speedup?

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

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

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

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 2: 65.5% accurate, 0.6× speedup?

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

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

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

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

\mathbf{elif}\;x \leq 1.05 \cdot 10^{+212}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.5000000000000002e43 or 4.49999999999999988e-48 < x < 1.05e212

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -2.5000000000000002e43 < x < -1.64999999999999992e-101 or 1.05e212 < x

    1. Initial program 99.9%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -1.64999999999999992e-101 < x < 4.49999999999999988e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 62.9% accurate, 0.6× speedup?

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

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

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

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

\mathbf{elif}\;x \leq 1.5 \cdot 10^{+235}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.1000000000000003e-12 or 4.8e-48 < x < 1.39999999999999999e212 or 1.50000000000000008e235 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -6.1000000000000003e-12 < x < 4.8e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 1.39999999999999999e212 < x < 1.50000000000000008e235

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 47.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(2 \cdot y\right)\\

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

\mathbf{elif}\;x \leq 9.2 \cdot 10^{+211}:\\
\;\;\;\;x \cdot t\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{+238}:\\
\;\;\;\;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 x < -1.02000000000000003e-8

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -1.02000000000000003e-8 < x < 8.99999999999999977e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 8.99999999999999977e-48 < x < 9.20000000000000044e211 or 4.4000000000000001e238 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 9.20000000000000044e211 < x < 4.4000000000000001e238

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 5: 46.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;x \leq -3.4 \cdot 10^{-51}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-48}:\\ \;\;\;\;5 \cdot y\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+211}:\\ \;\;\;\;x \cdot t\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+236}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 2.0 (* x z))))
   (if (<= x -3.4e-51)
     t_1
     (if (<= x 8.5e-48)
       (* 5.0 y)
       (if (<= x 4.6e+211) (* x t) (if (<= x 2.5e+236) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = 2.0 * (x * z);
	double tmp;
	if (x <= -3.4e-51) {
		tmp = t_1;
	} else if (x <= 8.5e-48) {
		tmp = 5.0 * y;
	} else if (x <= 4.6e+211) {
		tmp = x * t;
	} else if (x <= 2.5e+236) {
		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 * z)
    if (x <= (-3.4d-51)) then
        tmp = t_1
    else if (x <= 8.5d-48) then
        tmp = 5.0d0 * y
    else if (x <= 4.6d+211) then
        tmp = x * t
    else if (x <= 2.5d+236) 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 * z);
	double tmp;
	if (x <= -3.4e-51) {
		tmp = t_1;
	} else if (x <= 8.5e-48) {
		tmp = 5.0 * y;
	} else if (x <= 4.6e+211) {
		tmp = x * t;
	} else if (x <= 2.5e+236) {
		tmp = t_1;
	} else {
		tmp = x * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 2.0 * (x * z)
	tmp = 0
	if x <= -3.4e-51:
		tmp = t_1
	elif x <= 8.5e-48:
		tmp = 5.0 * y
	elif x <= 4.6e+211:
		tmp = x * t
	elif x <= 2.5e+236:
		tmp = t_1
	else:
		tmp = x * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(2.0 * Float64(x * z))
	tmp = 0.0
	if (x <= -3.4e-51)
		tmp = t_1;
	elseif (x <= 8.5e-48)
		tmp = Float64(5.0 * y);
	elseif (x <= 4.6e+211)
		tmp = Float64(x * t);
	elseif (x <= 2.5e+236)
		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 * z);
	tmp = 0.0;
	if (x <= -3.4e-51)
		tmp = t_1;
	elseif (x <= 8.5e-48)
		tmp = 5.0 * y;
	elseif (x <= 4.6e+211)
		tmp = x * t;
	elseif (x <= 2.5e+236)
		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 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e-51], t$95$1, If[LessEqual[x, 8.5e-48], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 4.6e+211], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.5e+236], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 4.6 \cdot 10^{+211}:\\
\;\;\;\;x \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.40000000000000003e-51 or 4.60000000000000022e211 < x < 2.49999999999999985e236

    1. Initial program 100.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -3.40000000000000003e-51 < x < 8.5000000000000004e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 8.5000000000000004e-48 < x < 4.60000000000000022e211 or 2.49999999999999985e236 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 88.9% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.0499999999999999e-14 or 8.5000000000000004e-48 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -1.0499999999999999e-14 < x < -1.15000000000000004e-193

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -1.15000000000000004e-193 < x < 8.5000000000000004e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 88.9% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.5e-52 or 7.2000000000000003e-48 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -4.5e-52 < x < 7.2000000000000003e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 78.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(5 + x \cdot 2\right)\\ \mathbf{if}\;y \leq -2.15 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 7.4 \cdot 10^{+77}:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
   (if (<= y -2.15e+23) t_1 (if (<= y 7.4e+77) (* x (+ t (* 2.0 z))) 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 <= -2.15e+23) {
		tmp = t_1;
	} else if (y <= 7.4e+77) {
		tmp = x * (t + (2.0 * z));
	} 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 <= (-2.15d+23)) then
        tmp = t_1
    else if (y <= 7.4d+77) then
        tmp = x * (t + (2.0d0 * z))
    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 <= -2.15e+23) {
		tmp = t_1;
	} else if (y <= 7.4e+77) {
		tmp = x * (t + (2.0 * z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (5.0 + (x * 2.0))
	tmp = 0
	if y <= -2.15e+23:
		tmp = t_1
	elif y <= 7.4e+77:
		tmp = x * (t + (2.0 * z))
	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 <= -2.15e+23)
		tmp = t_1;
	elseif (y <= 7.4e+77)
		tmp = Float64(x * Float64(t + Float64(2.0 * z)));
	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 <= -2.15e+23)
		tmp = t_1;
	elseif (y <= 7.4e+77)
		tmp = x * (t + (2.0 * z));
	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, -2.15e+23], t$95$1, If[LessEqual[y, 7.4e+77], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.1499999999999999e23 or 7.3999999999999999e77 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -2.1499999999999999e23 < y < 7.3999999999999999e77

    1. Initial program 99.9%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 47.3% accurate, 1.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.5999999999999998e-13 or 7.800000000000001e-48 < 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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if -3.5999999999999998e-13 < x < 7.800000000000001e-48

    1. Initial program 99.8%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 99.9% accurate, 1.2× speedup?

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

\\
x \cdot \left(\left(y + z\right) \cdot 2 + 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. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Add Preprocessing

Alternative 11: 29.5% accurate, 5.0× speedup?

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

\\
5 \cdot y
\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. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  5. Simplified0

    \[\leadsto expr\]
  6. Add Preprocessing

Reproduce

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