Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.3% → 96.5%
Time: 10.0s
Alternatives: 13
Speedup: 0.8×

Specification

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

\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\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 13 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: 92.3% accurate, 1.0× speedup?

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

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

Alternative 1: 96.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\ \mathbf{if}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b))))
   (if (<= t_1 INFINITY) t_1 (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = z * (y + (a * b));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = z * (y + (a * b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b)
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = z * (y + (a * b))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(y + Float64(a * b)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = z * (y + (a * b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0

    1. Initial program 98.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]

    if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 0.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+0.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative0.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative0.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative0.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*8.3%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out50.0%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def58.3%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg58.3%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg58.3%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative58.3%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg58.3%

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

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified58.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around inf 91.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b \leq \infty:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \end{array} \]

Alternative 2: 95.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+163} \lor \neg \left(a \leq 3.5 \cdot 10^{+86}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.80000000000000008e163 or 3.50000000000000019e86 < a

    1. Initial program 85.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+85.4%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative85.4%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative85.4%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative85.4%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*90.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out98.4%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def98.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative98.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg98.4%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg98.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative98.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg98.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg98.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative98.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def98.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified98.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around 0 99.9%

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

    if -3.80000000000000008e163 < a < 3.50000000000000019e86

    1. Initial program 96.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative96.8%

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified96.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.8 \cdot 10^{+163} \lor \neg \left(a \leq 3.5 \cdot 10^{+86}\right):\\ \;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 3: 72.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot a\\ t_2 := z \cdot \left(y + a \cdot b\right)\\ \mathbf{if}\;z \leq -170000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-33}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-148}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* t a))) (t_2 (* z (+ y (* a b)))))
   (if (<= z -170000.0)
     t_2
     (if (<= z -3.4e-12)
       t_1
       (if (<= z -2.5e-33)
         (* (* z a) b)
         (if (<= z -1.25e-148) (+ x (* y z)) (if (<= z 6.6e-61) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (t * a);
	double t_2 = z * (y + (a * b));
	double tmp;
	if (z <= -170000.0) {
		tmp = t_2;
	} else if (z <= -3.4e-12) {
		tmp = t_1;
	} else if (z <= -2.5e-33) {
		tmp = (z * a) * b;
	} else if (z <= -1.25e-148) {
		tmp = x + (y * z);
	} else if (z <= 6.6e-61) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x + (t * a)
    t_2 = z * (y + (a * b))
    if (z <= (-170000.0d0)) then
        tmp = t_2
    else if (z <= (-3.4d-12)) then
        tmp = t_1
    else if (z <= (-2.5d-33)) then
        tmp = (z * a) * b
    else if (z <= (-1.25d-148)) then
        tmp = x + (y * z)
    else if (z <= 6.6d-61) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (t * a);
	double t_2 = z * (y + (a * b));
	double tmp;
	if (z <= -170000.0) {
		tmp = t_2;
	} else if (z <= -3.4e-12) {
		tmp = t_1;
	} else if (z <= -2.5e-33) {
		tmp = (z * a) * b;
	} else if (z <= -1.25e-148) {
		tmp = x + (y * z);
	} else if (z <= 6.6e-61) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (t * a)
	t_2 = z * (y + (a * b))
	tmp = 0
	if z <= -170000.0:
		tmp = t_2
	elif z <= -3.4e-12:
		tmp = t_1
	elif z <= -2.5e-33:
		tmp = (z * a) * b
	elif z <= -1.25e-148:
		tmp = x + (y * z)
	elif z <= 6.6e-61:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(t * a))
	t_2 = Float64(z * Float64(y + Float64(a * b)))
	tmp = 0.0
	if (z <= -170000.0)
		tmp = t_2;
	elseif (z <= -3.4e-12)
		tmp = t_1;
	elseif (z <= -2.5e-33)
		tmp = Float64(Float64(z * a) * b);
	elseif (z <= -1.25e-148)
		tmp = Float64(x + Float64(y * z));
	elseif (z <= 6.6e-61)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (t * a);
	t_2 = z * (y + (a * b));
	tmp = 0.0;
	if (z <= -170000.0)
		tmp = t_2;
	elseif (z <= -3.4e-12)
		tmp = t_1;
	elseif (z <= -2.5e-33)
		tmp = (z * a) * b;
	elseif (z <= -1.25e-148)
		tmp = x + (y * z);
	elseif (z <= 6.6e-61)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -170000.0], t$95$2, If[LessEqual[z, -3.4e-12], t$95$1, If[LessEqual[z, -2.5e-33], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[z, -1.25e-148], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-61], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := z \cdot \left(y + a \cdot b\right)\\
\mathbf{if}\;z \leq -170000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -3.4 \cdot 10^{-12}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\

\mathbf{elif}\;z \leq -1.25 \cdot 10^{-148}:\\
\;\;\;\;x + y \cdot z\\

\mathbf{elif}\;z \leq 6.6 \cdot 10^{-61}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.7e5 or 6.59999999999999992e-61 < z

    1. Initial program 89.7%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.7%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative89.7%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative89.7%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.7%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*87.7%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out90.4%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def91.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative91.1%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg91.1%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg91.1%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative91.1%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg91.1%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg91.1%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative91.1%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def91.1%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified91.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around inf 80.0%

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

    if -1.7e5 < z < -3.4000000000000001e-12 or -1.25e-148 < z < 6.59999999999999992e-61

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around 0 83.7%

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

    if -3.4000000000000001e-12 < z < -2.50000000000000014e-33

    1. Initial program 66.7%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+66.7%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative66.7%

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative66.7%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*66.1%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.5%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.5%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 99.5%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative99.5%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified99.5%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
    7. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(a \cdot z\right) \cdot b} \]
      2. *-commutative100.0%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]
      3. add-log-exp68.0%

        \[\leadsto \color{blue}{\log \left(e^{b \cdot \left(a \cdot z\right)}\right)} \]
      4. *-commutative68.0%

        \[\leadsto \log \left(e^{\color{blue}{\left(a \cdot z\right) \cdot b}}\right) \]
      5. exp-prod68.0%

        \[\leadsto \log \color{blue}{\left({\left(e^{a \cdot z}\right)}^{b}\right)} \]
      6. *-commutative68.0%

        \[\leadsto \log \left({\left(e^{\color{blue}{z \cdot a}}\right)}^{b}\right) \]
      7. exp-prod2.4%

        \[\leadsto \log \left({\color{blue}{\left({\left(e^{z}\right)}^{a}\right)}}^{b}\right) \]
    8. Applied egg-rr2.4%

      \[\leadsto \color{blue}{\log \left({\left({\left(e^{z}\right)}^{a}\right)}^{b}\right)} \]
    9. Step-by-step derivation
      1. log-pow2.4%

        \[\leadsto \color{blue}{b \cdot \log \left({\left(e^{z}\right)}^{a}\right)} \]
      2. log-pow16.3%

        \[\leadsto b \cdot \color{blue}{\left(a \cdot \log \left(e^{z}\right)\right)} \]
      3. rem-log-exp100.0%

        \[\leadsto b \cdot \left(a \cdot \color{blue}{z}\right) \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]

    if -2.50000000000000014e-33 < z < -1.25e-148

    1. Initial program 99.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative99.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in a around 0 68.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -170000:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-12}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-33}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-148}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-61}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \end{array} \]

Alternative 4: 37.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(z \cdot b\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{-34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.36 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.66 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-61}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+159}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* z b))))
   (if (<= z -5.2e-34)
     t_1
     (if (<= z 1.36e-291)
       x
       (if (<= z 1.66e-155)
         (* t a)
         (if (<= z 4.4e-61) x (if (<= z 3.5e+159) (* y z) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (z * b);
	double tmp;
	if (z <= -5.2e-34) {
		tmp = t_1;
	} else if (z <= 1.36e-291) {
		tmp = x;
	} else if (z <= 1.66e-155) {
		tmp = t * a;
	} else if (z <= 4.4e-61) {
		tmp = x;
	} else if (z <= 3.5e+159) {
		tmp = y * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = a * (z * b)
    if (z <= (-5.2d-34)) then
        tmp = t_1
    else if (z <= 1.36d-291) then
        tmp = x
    else if (z <= 1.66d-155) then
        tmp = t * a
    else if (z <= 4.4d-61) then
        tmp = x
    else if (z <= 3.5d+159) then
        tmp = y * z
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (z * b);
	double tmp;
	if (z <= -5.2e-34) {
		tmp = t_1;
	} else if (z <= 1.36e-291) {
		tmp = x;
	} else if (z <= 1.66e-155) {
		tmp = t * a;
	} else if (z <= 4.4e-61) {
		tmp = x;
	} else if (z <= 3.5e+159) {
		tmp = y * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = a * (z * b)
	tmp = 0
	if z <= -5.2e-34:
		tmp = t_1
	elif z <= 1.36e-291:
		tmp = x
	elif z <= 1.66e-155:
		tmp = t * a
	elif z <= 4.4e-61:
		tmp = x
	elif z <= 3.5e+159:
		tmp = y * z
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(z * b))
	tmp = 0.0
	if (z <= -5.2e-34)
		tmp = t_1;
	elseif (z <= 1.36e-291)
		tmp = x;
	elseif (z <= 1.66e-155)
		tmp = Float64(t * a);
	elseif (z <= 4.4e-61)
		tmp = x;
	elseif (z <= 3.5e+159)
		tmp = Float64(y * z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (z * b);
	tmp = 0.0;
	if (z <= -5.2e-34)
		tmp = t_1;
	elseif (z <= 1.36e-291)
		tmp = x;
	elseif (z <= 1.66e-155)
		tmp = t * a;
	elseif (z <= 4.4e-61)
		tmp = x;
	elseif (z <= 3.5e+159)
		tmp = y * z;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e-34], t$95$1, If[LessEqual[z, 1.36e-291], x, If[LessEqual[z, 1.66e-155], N[(t * a), $MachinePrecision], If[LessEqual[z, 4.4e-61], x, If[LessEqual[z, 3.5e+159], N[(y * z), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{-34}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.36 \cdot 10^{-291}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.66 \cdot 10^{-155}:\\
\;\;\;\;t \cdot a\\

\mathbf{elif}\;z \leq 4.4 \cdot 10^{-61}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 3.5 \cdot 10^{+159}:\\
\;\;\;\;y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.1999999999999999e-34 or 3.4999999999999999e159 < z

    1. Initial program 83.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+83.2%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative83.2%

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

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

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*84.1%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out89.5%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def90.5%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg90.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg90.5%

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

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified90.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 49.4%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative49.4%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified49.4%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]

    if -5.1999999999999999e-34 < z < 1.36000000000000007e-291 or 1.65999999999999999e-155 < z < 4.40000000000000017e-61

    1. Initial program 99.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative99.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around inf 52.9%

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

    if 1.36000000000000007e-291 < z < 1.65999999999999999e-155

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in t around inf 59.7%

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

    if 4.40000000000000017e-61 < z < 3.4999999999999999e159

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*93.4%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out93.4%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def93.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified93.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around inf 48.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{-34}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;z \leq 1.36 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.66 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-61}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+159}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \end{array} \]

Alternative 5: 38.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{-34}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+162}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -2.6e-34)
   (* (* z a) b)
   (if (<= z 1.7e-291)
     x
     (if (<= z 8.8e-155)
       (* t a)
       (if (<= z 1.05e-60) x (if (<= z 1.4e+162) (* y z) (* a (* z b))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -2.6e-34) {
		tmp = (z * a) * b;
	} else if (z <= 1.7e-291) {
		tmp = x;
	} else if (z <= 8.8e-155) {
		tmp = t * a;
	} else if (z <= 1.05e-60) {
		tmp = x;
	} else if (z <= 1.4e+162) {
		tmp = y * z;
	} else {
		tmp = a * (z * b);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (z <= (-2.6d-34)) then
        tmp = (z * a) * b
    else if (z <= 1.7d-291) then
        tmp = x
    else if (z <= 8.8d-155) then
        tmp = t * a
    else if (z <= 1.05d-60) then
        tmp = x
    else if (z <= 1.4d+162) then
        tmp = y * z
    else
        tmp = a * (z * b)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -2.6e-34) {
		tmp = (z * a) * b;
	} else if (z <= 1.7e-291) {
		tmp = x;
	} else if (z <= 8.8e-155) {
		tmp = t * a;
	} else if (z <= 1.05e-60) {
		tmp = x;
	} else if (z <= 1.4e+162) {
		tmp = y * z;
	} else {
		tmp = a * (z * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -2.6e-34:
		tmp = (z * a) * b
	elif z <= 1.7e-291:
		tmp = x
	elif z <= 8.8e-155:
		tmp = t * a
	elif z <= 1.05e-60:
		tmp = x
	elif z <= 1.4e+162:
		tmp = y * z
	else:
		tmp = a * (z * b)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -2.6e-34)
		tmp = Float64(Float64(z * a) * b);
	elseif (z <= 1.7e-291)
		tmp = x;
	elseif (z <= 8.8e-155)
		tmp = Float64(t * a);
	elseif (z <= 1.05e-60)
		tmp = x;
	elseif (z <= 1.4e+162)
		tmp = Float64(y * z);
	else
		tmp = Float64(a * Float64(z * b));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -2.6e-34)
		tmp = (z * a) * b;
	elseif (z <= 1.7e-291)
		tmp = x;
	elseif (z <= 8.8e-155)
		tmp = t * a;
	elseif (z <= 1.05e-60)
		tmp = x;
	elseif (z <= 1.4e+162)
		tmp = y * z;
	else
		tmp = a * (z * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.6e-34], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[z, 1.7e-291], x, If[LessEqual[z, 8.8e-155], N[(t * a), $MachinePrecision], If[LessEqual[z, 1.05e-60], x, If[LessEqual[z, 1.4e+162], N[(y * z), $MachinePrecision], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-34}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\

\mathbf{elif}\;z \leq 1.7 \cdot 10^{-291}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 8.8 \cdot 10^{-155}:\\
\;\;\;\;t \cdot a\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{-60}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{+162}:\\
\;\;\;\;y \cdot z\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.5999999999999999e-34

    1. Initial program 86.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+86.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative86.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative86.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative86.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*86.1%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out89.2%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def90.8%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg90.8%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg90.8%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative90.8%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg90.8%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg90.8%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative90.8%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def90.8%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified90.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 42.8%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative42.8%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified42.8%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
    7. Step-by-step derivation
      1. associate-*r*45.9%

        \[\leadsto \color{blue}{\left(a \cdot z\right) \cdot b} \]
      2. *-commutative45.9%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]
      3. add-log-exp36.5%

        \[\leadsto \color{blue}{\log \left(e^{b \cdot \left(a \cdot z\right)}\right)} \]
      4. *-commutative36.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(a \cdot z\right) \cdot b}}\right) \]
      5. exp-prod37.9%

        \[\leadsto \log \color{blue}{\left({\left(e^{a \cdot z}\right)}^{b}\right)} \]
      6. *-commutative37.9%

        \[\leadsto \log \left({\left(e^{\color{blue}{z \cdot a}}\right)}^{b}\right) \]
      7. exp-prod34.8%

        \[\leadsto \log \left({\color{blue}{\left({\left(e^{z}\right)}^{a}\right)}}^{b}\right) \]
    8. Applied egg-rr34.8%

      \[\leadsto \color{blue}{\log \left({\left({\left(e^{z}\right)}^{a}\right)}^{b}\right)} \]
    9. Step-by-step derivation
      1. log-pow34.8%

        \[\leadsto \color{blue}{b \cdot \log \left({\left(e^{z}\right)}^{a}\right)} \]
      2. log-pow35.5%

        \[\leadsto b \cdot \color{blue}{\left(a \cdot \log \left(e^{z}\right)\right)} \]
      3. rem-log-exp45.9%

        \[\leadsto b \cdot \left(a \cdot \color{blue}{z}\right) \]
    10. Simplified45.9%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]

    if -2.5999999999999999e-34 < z < 1.70000000000000013e-291 or 8.7999999999999996e-155 < z < 1.04999999999999996e-60

    1. Initial program 99.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative99.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative99.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around inf 52.9%

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

    if 1.70000000000000013e-291 < z < 8.7999999999999996e-155

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in t around inf 59.7%

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

    if 1.04999999999999996e-60 < z < 1.39999999999999995e162

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*93.4%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out93.4%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def93.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def93.4%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified93.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around inf 48.0%

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

    if 1.39999999999999995e162 < z

    1. Initial program 77.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+77.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative77.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative77.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative77.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*79.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out89.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def89.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative89.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg89.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg89.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative89.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg89.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg89.9%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative89.9%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def89.9%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified89.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 63.5%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative63.5%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified63.5%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification51.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{-34}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+162}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \end{array} \]

Alternative 6: 56.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot z\\ t_2 := \left(z \cdot a\right) \cdot b\\ \mathbf{if}\;b \leq -3.8 \cdot 10^{+64}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 3.1 \cdot 10^{+102}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{elif}\;b \leq 4.65 \cdot 10^{+160}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+213}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* y z))) (t_2 (* (* z a) b)))
   (if (<= b -3.8e+64)
     t_2
     (if (<= b 9.5e-37)
       t_1
       (if (<= b 3.1e+102)
         (+ x (* t a))
         (if (<= b 4.65e+160) (* a (* z b)) (if (<= b 4.6e+213) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * z);
	double t_2 = (z * a) * b;
	double tmp;
	if (b <= -3.8e+64) {
		tmp = t_2;
	} else if (b <= 9.5e-37) {
		tmp = t_1;
	} else if (b <= 3.1e+102) {
		tmp = x + (t * a);
	} else if (b <= 4.65e+160) {
		tmp = a * (z * b);
	} else if (b <= 4.6e+213) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x + (y * z)
    t_2 = (z * a) * b
    if (b <= (-3.8d+64)) then
        tmp = t_2
    else if (b <= 9.5d-37) then
        tmp = t_1
    else if (b <= 3.1d+102) then
        tmp = x + (t * a)
    else if (b <= 4.65d+160) then
        tmp = a * (z * b)
    else if (b <= 4.6d+213) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * z);
	double t_2 = (z * a) * b;
	double tmp;
	if (b <= -3.8e+64) {
		tmp = t_2;
	} else if (b <= 9.5e-37) {
		tmp = t_1;
	} else if (b <= 3.1e+102) {
		tmp = x + (t * a);
	} else if (b <= 4.65e+160) {
		tmp = a * (z * b);
	} else if (b <= 4.6e+213) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (y * z)
	t_2 = (z * a) * b
	tmp = 0
	if b <= -3.8e+64:
		tmp = t_2
	elif b <= 9.5e-37:
		tmp = t_1
	elif b <= 3.1e+102:
		tmp = x + (t * a)
	elif b <= 4.65e+160:
		tmp = a * (z * b)
	elif b <= 4.6e+213:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(y * z))
	t_2 = Float64(Float64(z * a) * b)
	tmp = 0.0
	if (b <= -3.8e+64)
		tmp = t_2;
	elseif (b <= 9.5e-37)
		tmp = t_1;
	elseif (b <= 3.1e+102)
		tmp = Float64(x + Float64(t * a));
	elseif (b <= 4.65e+160)
		tmp = Float64(a * Float64(z * b));
	elseif (b <= 4.6e+213)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (y * z);
	t_2 = (z * a) * b;
	tmp = 0.0;
	if (b <= -3.8e+64)
		tmp = t_2;
	elseif (b <= 9.5e-37)
		tmp = t_1;
	elseif (b <= 3.1e+102)
		tmp = x + (t * a);
	elseif (b <= 4.65e+160)
		tmp = a * (z * b);
	elseif (b <= 4.6e+213)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -3.8e+64], t$95$2, If[LessEqual[b, 9.5e-37], t$95$1, If[LessEqual[b, 3.1e+102], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.65e+160], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.6e+213], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + y \cdot z\\
t_2 := \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;b \leq -3.8 \cdot 10^{+64}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;b \leq 9.5 \cdot 10^{-37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 3.1 \cdot 10^{+102}:\\
\;\;\;\;x + t \cdot a\\

\mathbf{elif}\;b \leq 4.65 \cdot 10^{+160}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\

\mathbf{elif}\;b \leq 4.6 \cdot 10^{+213}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -3.8000000000000001e64 or 4.59999999999999996e213 < b

    1. Initial program 87.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+87.4%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative87.4%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative87.4%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative87.4%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*76.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out81.6%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def81.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative81.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg81.6%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg81.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative81.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg81.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg81.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative81.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def81.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified81.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 66.4%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative66.4%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified66.4%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
    7. Step-by-step derivation
      1. associate-*r*72.3%

        \[\leadsto \color{blue}{\left(a \cdot z\right) \cdot b} \]
      2. *-commutative72.3%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]
      3. add-log-exp41.7%

        \[\leadsto \color{blue}{\log \left(e^{b \cdot \left(a \cdot z\right)}\right)} \]
      4. *-commutative41.7%

        \[\leadsto \log \left(e^{\color{blue}{\left(a \cdot z\right) \cdot b}}\right) \]
      5. exp-prod39.7%

        \[\leadsto \log \color{blue}{\left({\left(e^{a \cdot z}\right)}^{b}\right)} \]
      6. *-commutative39.7%

        \[\leadsto \log \left({\left(e^{\color{blue}{z \cdot a}}\right)}^{b}\right) \]
      7. exp-prod37.7%

        \[\leadsto \log \left({\color{blue}{\left({\left(e^{z}\right)}^{a}\right)}}^{b}\right) \]
    8. Applied egg-rr37.7%

      \[\leadsto \color{blue}{\log \left({\left({\left(e^{z}\right)}^{a}\right)}^{b}\right)} \]
    9. Step-by-step derivation
      1. log-pow37.7%

        \[\leadsto \color{blue}{b \cdot \log \left({\left(e^{z}\right)}^{a}\right)} \]
      2. log-pow37.7%

        \[\leadsto b \cdot \color{blue}{\left(a \cdot \log \left(e^{z}\right)\right)} \]
      3. rem-log-exp72.3%

        \[\leadsto b \cdot \left(a \cdot \color{blue}{z}\right) \]
    10. Simplified72.3%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} \]

    if -3.8000000000000001e64 < b < 9.49999999999999927e-37 or 4.64999999999999973e160 < b < 4.59999999999999996e213

    1. Initial program 95.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+95.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative95.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative95.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative95.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*98.6%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out98.6%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.3%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.3%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.3%

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

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.3%

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

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in a around 0 70.3%

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

    if 9.49999999999999927e-37 < b < 3.09999999999999987e102

    1. Initial program 97.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+97.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative97.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative97.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative97.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*97.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.8%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.8%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.8%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.8%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.8%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.8%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.8%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around 0 70.5%

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

    if 3.09999999999999987e102 < b < 4.64999999999999973e160

    1. Initial program 92.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+92.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative92.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative92.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative92.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*92.7%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in b around inf 72.3%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    5. Step-by-step derivation
      1. *-commutative72.3%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    6. Simplified72.3%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification70.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{+64}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-37}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{elif}\;b \leq 3.1 \cdot 10^{+102}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{elif}\;b \leq 4.65 \cdot 10^{+160}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+213}:\\ \;\;\;\;x + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b\\ \end{array} \]

Alternative 7: 72.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \lor \neg \left(a \leq 5 \cdot 10^{-74}\right) \land \left(a \leq 6.7 \cdot 10^{+16} \lor \neg \left(a \leq 1.7 \cdot 10^{+78}\right)\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.1000000000000001 or 4.99999999999999998e-74 < a < 6.7e16 or 1.70000000000000004e78 < a

    1. Initial program 89.7%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.7%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative89.7%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative89.7%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.7%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*93.2%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out96.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def97.7%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg97.7%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg97.7%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative97.7%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg97.7%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg97.7%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def97.7%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified97.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in a around inf 75.3%

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

    if -1.1000000000000001 < a < 4.99999999999999998e-74 or 6.7e16 < a < 1.70000000000000004e78

    1. Initial program 98.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+98.3%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative98.3%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative98.3%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative98.3%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*92.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out92.0%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def92.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative92.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg92.0%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg92.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative92.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg92.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg92.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative92.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def92.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified92.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in a around 0 79.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.1 \lor \neg \left(a \leq 5 \cdot 10^{-74}\right) \land \left(a \leq 6.7 \cdot 10^{+16} \lor \neg \left(a \leq 1.7 \cdot 10^{+78}\right)\right):\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot z\\ \end{array} \]

Alternative 8: 80.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+63} \lor \neg \left(z \leq 2.55 \cdot 10^{-59}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5000000000000004e63 or 2.5499999999999998e-59 < z

    1. Initial program 89.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative89.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative89.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*86.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out89.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def90.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified90.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around inf 80.6%

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

    if -8.5000000000000004e63 < z < 2.5499999999999998e-59

    1. Initial program 99.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+99.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative99.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative99.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative99.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.1%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around 0 91.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+63} \lor \neg \left(z \leq 2.55 \cdot 10^{-59}\right):\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\ \end{array} \]

Alternative 9: 87.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+19} \lor \neg \left(z \leq 5 \cdot 10^{-67}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.8e19 or 4.9999999999999999e-67 < z

    1. Initial program 89.6%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.6%

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

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.6%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*87.5%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out90.3%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def91.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative91.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg91.0%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg91.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative91.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg91.0%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg91.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative91.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def91.0%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified91.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in t around 0 83.1%

      \[\leadsto \color{blue}{x + \left(a \cdot \left(b \cdot z\right) + y \cdot z\right)} \]
    5. Step-by-step derivation
      1. +-commutative83.1%

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

        \[\leadsto x + \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) \]
      3. distribute-rgt-in92.0%

        \[\leadsto x + \color{blue}{z \cdot \left(y + a \cdot b\right)} \]
    6. Simplified92.0%

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

    if -2.8e19 < z < 4.9999999999999999e-67

    1. Initial program 99.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+99.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative99.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative99.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative99.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around 0 92.4%

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

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

Alternative 10: 38.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+62}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.45e+62)
   (* y z)
   (if (<= z 2.55e-291)
     x
     (if (<= z 1.12e-155) (* t a) (if (<= z 4.5e-62) x (* y z))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.45e+62) {
		tmp = y * z;
	} else if (z <= 2.55e-291) {
		tmp = x;
	} else if (z <= 1.12e-155) {
		tmp = t * a;
	} else if (z <= 4.5e-62) {
		tmp = x;
	} else {
		tmp = y * z;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (z <= (-1.45d+62)) then
        tmp = y * z
    else if (z <= 2.55d-291) then
        tmp = x
    else if (z <= 1.12d-155) then
        tmp = t * a
    else if (z <= 4.5d-62) then
        tmp = x
    else
        tmp = y * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.45e+62) {
		tmp = y * z;
	} else if (z <= 2.55e-291) {
		tmp = x;
	} else if (z <= 1.12e-155) {
		tmp = t * a;
	} else if (z <= 4.5e-62) {
		tmp = x;
	} else {
		tmp = y * z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -1.45e+62:
		tmp = y * z
	elif z <= 2.55e-291:
		tmp = x
	elif z <= 1.12e-155:
		tmp = t * a
	elif z <= 4.5e-62:
		tmp = x
	else:
		tmp = y * z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -1.45e+62)
		tmp = Float64(y * z);
	elseif (z <= 2.55e-291)
		tmp = x;
	elseif (z <= 1.12e-155)
		tmp = Float64(t * a);
	elseif (z <= 4.5e-62)
		tmp = x;
	else
		tmp = Float64(y * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -1.45e+62)
		tmp = y * z;
	elseif (z <= 2.55e-291)
		tmp = x;
	elseif (z <= 1.12e-155)
		tmp = t * a;
	elseif (z <= 4.5e-62)
		tmp = x;
	else
		tmp = y * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.45e+62], N[(y * z), $MachinePrecision], If[LessEqual[z, 2.55e-291], x, If[LessEqual[z, 1.12e-155], N[(t * a), $MachinePrecision], If[LessEqual[z, 4.5e-62], x, N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+62}:\\
\;\;\;\;y \cdot z\\

\mathbf{elif}\;z \leq 2.55 \cdot 10^{-291}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.12 \cdot 10^{-155}:\\
\;\;\;\;t \cdot a\\

\mathbf{elif}\;z \leq 4.5 \cdot 10^{-62}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.44999999999999992e62 or 4.50000000000000018e-62 < z

    1. Initial program 89.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.1%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative89.1%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative89.1%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.1%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*86.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out89.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def90.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. +-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, \color{blue}{t}\right), x + y \cdot z\right) \]
      14. +-commutative90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def90.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified90.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around inf 45.2%

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

    if -1.44999999999999992e62 < z < 2.55e-291 or 1.1200000000000001e-155 < z < 4.50000000000000018e-62

    1. Initial program 98.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+98.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative98.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative98.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative98.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*98.8%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around inf 48.2%

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

    if 2.55e-291 < z < 1.1200000000000001e-155

    1. Initial program 100.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+100.0%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative100.0%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative100.0%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*99.9%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg99.9%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg99.9%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def99.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in t around inf 59.7%

      \[\leadsto \color{blue}{a \cdot t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification47.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+62}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-291}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-155}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]

Alternative 11: 57.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+101}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+73}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -6.2e+101) (* y z) (if (<= y 1.3e+73) (+ x (* t a)) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -6.2e+101) {
		tmp = y * z;
	} else if (y <= 1.3e+73) {
		tmp = x + (t * a);
	} else {
		tmp = y * z;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= (-6.2d+101)) then
        tmp = y * z
    else if (y <= 1.3d+73) then
        tmp = x + (t * a)
    else
        tmp = y * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -6.2e+101) {
		tmp = y * z;
	} else if (y <= 1.3e+73) {
		tmp = x + (t * a);
	} else {
		tmp = y * z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -6.2e+101:
		tmp = y * z
	elif y <= 1.3e+73:
		tmp = x + (t * a)
	else:
		tmp = y * z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -6.2e+101)
		tmp = Float64(y * z);
	elseif (y <= 1.3e+73)
		tmp = Float64(x + Float64(t * a));
	else
		tmp = Float64(y * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -6.2e+101)
		tmp = y * z;
	elseif (y <= 1.3e+73)
		tmp = x + (t * a);
	else
		tmp = y * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -6.2e+101], N[(y * z), $MachinePrecision], If[LessEqual[y, 1.3e+73], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+101}:\\
\;\;\;\;y \cdot z\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+73}:\\
\;\;\;\;x + t \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.19999999999999998e101 or 1.3e73 < y

    1. Initial program 91.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+91.4%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative91.4%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative91.4%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative91.4%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*91.3%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out92.4%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def93.5%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg93.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg93.5%

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

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified93.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in y around inf 60.8%

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

    if -6.19999999999999998e101 < y < 1.3e73

    1. Initial program 95.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+95.2%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative95.2%

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

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

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*93.4%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out95.8%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def95.8%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg95.8%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg95.8%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg95.8%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg95.8%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def95.8%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified95.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in z around 0 58.1%

      \[\leadsto \color{blue}{x + a \cdot t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+101}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+73}:\\ \;\;\;\;x + t \cdot a\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]

Alternative 12: 38.4% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6.4 \cdot 10^{+41}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a -6.4e+41) (* t a) (if (<= a 1.7e-57) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -6.4e+41) {
		tmp = t * a;
	} else if (a <= 1.7e-57) {
		tmp = x;
	} else {
		tmp = t * a;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-6.4d+41)) then
        tmp = t * a
    else if (a <= 1.7d-57) then
        tmp = x
    else
        tmp = t * a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -6.4e+41) {
		tmp = t * a;
	} else if (a <= 1.7e-57) {
		tmp = x;
	} else {
		tmp = t * a;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= -6.4e+41:
		tmp = t * a
	elif a <= 1.7e-57:
		tmp = x
	else:
		tmp = t * a
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= -6.4e+41)
		tmp = Float64(t * a);
	elseif (a <= 1.7e-57)
		tmp = x;
	else
		tmp = Float64(t * a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= -6.4e+41)
		tmp = t * a;
	elseif (a <= 1.7e-57)
		tmp = x;
	else
		tmp = t * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -6.4e+41], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.7e-57], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.4 \cdot 10^{+41}:\\
\;\;\;\;t \cdot a\\

\mathbf{elif}\;a \leq 1.7 \cdot 10^{-57}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.40000000000000019e41 or 1.70000000000000008e-57 < a

    1. Initial program 89.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+89.4%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative89.4%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative89.4%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative89.4%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*93.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out96.8%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def97.6%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg97.6%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg97.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative97.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
      12. fma-neg97.6%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg97.6%

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
      15. fma-def97.6%

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified97.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in t around inf 35.0%

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

    if -6.40000000000000019e41 < a < 1.70000000000000008e-57

    1. Initial program 98.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+98.4%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative98.4%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative98.4%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative98.4%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*92.3%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out92.3%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def92.3%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
      9. remove-double-neg92.3%

        \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
      10. sub-neg92.3%

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z - \left(-t\right)}, x + y \cdot z\right) \]
      11. *-commutative92.3%

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

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
      13. remove-double-neg92.3%

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

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

        \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified92.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around inf 40.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.4 \cdot 10^{+41}:\\ \;\;\;\;t \cdot a\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot a\\ \end{array} \]

Alternative 13: 26.3% accurate, 15.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
	return x;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x;
}
def code(x, y, z, t, a, b):
	return x
function code(x, y, z, t, a, b)
	return x
end
function tmp = code(x, y, z, t, a, b)
	tmp = x;
end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 93.8%

    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
  2. Step-by-step derivation
    1. associate-+l+93.8%

      \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
    2. +-commutative93.8%

      \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
    3. *-commutative93.8%

      \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
    4. *-commutative93.8%

      \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
    5. associate-*l*92.6%

      \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
    6. distribute-rgt-out94.6%

      \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
    7. fma-def95.0%

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

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{b \cdot z + t}, x + y \cdot z\right) \]
    9. remove-double-neg95.0%

      \[\leadsto \mathsf{fma}\left(a, b \cdot z + \color{blue}{\left(-\left(-t\right)\right)}, x + y \cdot z\right) \]
    10. sub-neg95.0%

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

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{z \cdot b} - \left(-t\right), x + y \cdot z\right) \]
    12. fma-neg95.0%

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{\mathsf{fma}\left(z, b, -\left(-t\right)\right)}, x + y \cdot z\right) \]
    13. remove-double-neg95.0%

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

      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{y \cdot z + x}\right) \]
    15. fma-def95.0%

      \[\leadsto \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
  3. Simplified95.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), \mathsf{fma}\left(y, z, x\right)\right)} \]
  4. Taylor expanded in x around inf 27.6%

    \[\leadsto \color{blue}{x} \]
  5. Final simplification27.6%

    \[\leadsto x \]

Developer target: 97.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{if}\;z < -11820553527347888000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
   (if (< z -11820553527347888000.0)
     t_1
     (if (< z 4.7589743188364287e-122)
       (+ (* (+ (* b z) t) a) (+ (* z y) x))
       t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
	double tmp;
	if (z < -11820553527347888000.0) {
		tmp = t_1;
	} else if (z < 4.7589743188364287e-122) {
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * ((b * a) + y)) + (x + (t * a))
    if (z < (-11820553527347888000.0d0)) then
        tmp = t_1
    else if (z < 4.7589743188364287d-122) then
        tmp = (((b * z) + t) * a) + ((z * y) + x)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
	double tmp;
	if (z < -11820553527347888000.0) {
		tmp = t_1;
	} else if (z < 4.7589743188364287e-122) {
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z * ((b * a) + y)) + (x + (t * a))
	tmp = 0
	if z < -11820553527347888000.0:
		tmp = t_1
	elif z < 4.7589743188364287e-122:
		tmp = (((b * z) + t) * a) + ((z * y) + x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a)))
	tmp = 0.0
	if (z < -11820553527347888000.0)
		tmp = t_1;
	elseif (z < 4.7589743188364287e-122)
		tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (z * ((b * a) + y)) + (x + (t * a));
	tmp = 0.0;
	if (z < -11820553527347888000.0)
		tmp = t_1;
	elseif (z < 4.7589743188364287e-122)
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023290 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
  :precision binary64

  :herbie-target
  (if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))