Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.2% → 95.9%
Time: 9.1s
Alternatives: 17
Speedup: 0.9×

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 17 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.2% 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: 95.9% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, a \cdot b, \mathsf{fma}\left(t, a, \mathsf{fma}\left(y, z, x\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z 2.1e+21)
   (fma a (+ t (* z b)) (fma y z x))
   (fma z (* a b) (fma t a (fma y z x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 2.1e+21) {
		tmp = fma(a, (t + (z * b)), fma(y, z, x));
	} else {
		tmp = fma(z, (a * b), fma(t, a, fma(y, z, x)));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= 2.1e+21)
		tmp = fma(a, Float64(t + Float64(z * b)), fma(y, z, x));
	else
		tmp = fma(z, Float64(a * b), fma(t, a, fma(y, z, x)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2.1e+21], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision] + N[(t * a + N[(y * z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.1e21

    1. Initial program 94.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+94.0%

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

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative94.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*96.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-out99.0%

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

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

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

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

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

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

    if 2.1e21 < z

    1. Initial program 89.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. +-commutative89.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, a \cdot b, \mathsf{fma}\left(t, a, \mathsf{fma}\left(y, z, x\right)\right)\right)\\ \end{array} \]

Alternative 2: 95.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(z \cdot a\right)\\ \mathbf{if}\;t_1 \leq 5 \cdot 10^{+264}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ (* a t) (+ x (* z y))) (* b (* z a)))))
   (if (<= t_1 5e+264) t_1 (fma a (+ t (* z b)) (fma y z x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((a * t) + (x + (z * y))) + (b * (z * a));
	double tmp;
	if (t_1 <= 5e+264) {
		tmp = t_1;
	} else {
		tmp = fma(a, (t + (z * b)), fma(y, z, x));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(b * Float64(z * a)))
	tmp = 0.0
	if (t_1 <= 5e+264)
		tmp = t_1;
	else
		tmp = fma(a, Float64(t + Float64(z * b)), fma(y, z, x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+264], t$95$1, N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\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)) < 5.00000000000000033e264

    1. Initial program 98.9%

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

    if 5.00000000000000033e264 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 76.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+76.7%

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

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative76.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*86.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-out95.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(z \cdot a\right) \leq 5 \cdot 10^{+264}:\\ \;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(z \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\ \end{array} \]

Alternative 3: 96.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(z \cdot a\right)\\ \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 (+ (+ (* a t) (+ x (* z y))) (* b (* z a)))))
   (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 = ((a * t) + (x + (z * y))) + (b * (z * a));
	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 = ((a * t) + (x + (z * y))) + (b * (z * a));
	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 = ((a * t) + (x + (z * y))) + (b * (z * a))
	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(a * t) + Float64(x + Float64(z * y))) + Float64(b * Float64(z * a)))
	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 = ((a * t) + (x + (z * y))) + (b * (z * a));
	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[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(z * a), $MachinePrecision]), $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(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(z \cdot a\right)\\
\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 97.6%

      \[\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. *-commutative0.0%

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

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

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

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

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

Alternative 4: 83.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + a \cdot t\\ t_2 := z \cdot y + t_1\\ t_3 := a \cdot \left(z \cdot b\right)\\ \mathbf{if}\;t \leq -9 \cdot 10^{+80}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-18}:\\ \;\;\;\;b \cdot \left(z \cdot a\right) + \left(z \cdot y + a \cdot t\right)\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-44}:\\ \;\;\;\;z \cdot y + \left(x + t_3\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+166}:\\ \;\;\;\;t_3 + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* a t))) (t_2 (+ (* z y) t_1)) (t_3 (* a (* z b))))
   (if (<= t -9e+80)
     t_2
     (if (<= t -6e-18)
       (+ (* b (* z a)) (+ (* z y) (* a t)))
       (if (<= t 1.55e-44)
         (+ (* z y) (+ x t_3))
         (if (<= t 3.6e+166) (+ t_3 t_1) t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (a * t);
	double t_2 = (z * y) + t_1;
	double t_3 = a * (z * b);
	double tmp;
	if (t <= -9e+80) {
		tmp = t_2;
	} else if (t <= -6e-18) {
		tmp = (b * (z * a)) + ((z * y) + (a * t));
	} else if (t <= 1.55e-44) {
		tmp = (z * y) + (x + t_3);
	} else if (t <= 3.6e+166) {
		tmp = t_3 + 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) :: t_3
    real(8) :: tmp
    t_1 = x + (a * t)
    t_2 = (z * y) + t_1
    t_3 = a * (z * b)
    if (t <= (-9d+80)) then
        tmp = t_2
    else if (t <= (-6d-18)) then
        tmp = (b * (z * a)) + ((z * y) + (a * t))
    else if (t <= 1.55d-44) then
        tmp = (z * y) + (x + t_3)
    else if (t <= 3.6d+166) then
        tmp = t_3 + 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 + (a * t);
	double t_2 = (z * y) + t_1;
	double t_3 = a * (z * b);
	double tmp;
	if (t <= -9e+80) {
		tmp = t_2;
	} else if (t <= -6e-18) {
		tmp = (b * (z * a)) + ((z * y) + (a * t));
	} else if (t <= 1.55e-44) {
		tmp = (z * y) + (x + t_3);
	} else if (t <= 3.6e+166) {
		tmp = t_3 + t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (a * t)
	t_2 = (z * y) + t_1
	t_3 = a * (z * b)
	tmp = 0
	if t <= -9e+80:
		tmp = t_2
	elif t <= -6e-18:
		tmp = (b * (z * a)) + ((z * y) + (a * t))
	elif t <= 1.55e-44:
		tmp = (z * y) + (x + t_3)
	elif t <= 3.6e+166:
		tmp = t_3 + t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(a * t))
	t_2 = Float64(Float64(z * y) + t_1)
	t_3 = Float64(a * Float64(z * b))
	tmp = 0.0
	if (t <= -9e+80)
		tmp = t_2;
	elseif (t <= -6e-18)
		tmp = Float64(Float64(b * Float64(z * a)) + Float64(Float64(z * y) + Float64(a * t)));
	elseif (t <= 1.55e-44)
		tmp = Float64(Float64(z * y) + Float64(x + t_3));
	elseif (t <= 3.6e+166)
		tmp = Float64(t_3 + t_1);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (a * t);
	t_2 = (z * y) + t_1;
	t_3 = a * (z * b);
	tmp = 0.0;
	if (t <= -9e+80)
		tmp = t_2;
	elseif (t <= -6e-18)
		tmp = (b * (z * a)) + ((z * y) + (a * t));
	elseif (t <= 1.55e-44)
		tmp = (z * y) + (x + t_3);
	elseif (t <= 3.6e+166)
		tmp = t_3 + 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[(a * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * y), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e+80], t$95$2, If[LessEqual[t, -6e-18], N[(N[(b * N[(z * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.55e-44], N[(N[(z * y), $MachinePrecision] + N[(x + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+166], N[(t$95$3 + t$95$1), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -6 \cdot 10^{-18}:\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(z \cdot y + a \cdot t\right)\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{-44}:\\
\;\;\;\;z \cdot y + \left(x + t_3\right)\\

\mathbf{elif}\;t \leq 3.6 \cdot 10^{+166}:\\
\;\;\;\;t_3 + t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -9.00000000000000013e80 or 3.5999999999999997e166 < t

    1. Initial program 94.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. *-commutative94.4%

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

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

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

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

    if -9.00000000000000013e80 < t < -5.99999999999999966e-18

    1. Initial program 95.6%

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

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

    if -5.99999999999999966e-18 < t < 1.54999999999999992e-44

    1. Initial program 94.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+94.2%

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

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative94.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*95.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-out95.1%

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

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

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

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

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

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

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

    if 1.54999999999999992e-44 < t < 3.5999999999999997e166

    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. +-commutative86.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{+80}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-18}:\\ \;\;\;\;b \cdot \left(z \cdot a\right) + \left(z \cdot y + a \cdot t\right)\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-44}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot \left(z \cdot b\right)\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+166}:\\ \;\;\;\;a \cdot \left(z \cdot b\right) + \left(x + a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \end{array} \]

Alternative 5: 84.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(z \cdot b\right)\\ t_2 := x + a \cdot t\\ t_3 := z \cdot y + t_2\\ \mathbf{if}\;t \leq -7 \cdot 10^{-19}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-44}:\\ \;\;\;\;z \cdot y + \left(x + t_1\right)\\ \mathbf{elif}\;t \leq 2.15 \cdot 10^{+167}:\\ \;\;\;\;t_1 + t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* z b))) (t_2 (+ x (* a t))) (t_3 (+ (* z y) t_2)))
   (if (<= t -7e-19)
     t_3
     (if (<= t 3.4e-44)
       (+ (* z y) (+ x t_1))
       (if (<= t 2.15e+167) (+ t_1 t_2) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (z * b);
	double t_2 = x + (a * t);
	double t_3 = (z * y) + t_2;
	double tmp;
	if (t <= -7e-19) {
		tmp = t_3;
	} else if (t <= 3.4e-44) {
		tmp = (z * y) + (x + t_1);
	} else if (t <= 2.15e+167) {
		tmp = t_1 + t_2;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = a * (z * b)
    t_2 = x + (a * t)
    t_3 = (z * y) + t_2
    if (t <= (-7d-19)) then
        tmp = t_3
    else if (t <= 3.4d-44) then
        tmp = (z * y) + (x + t_1)
    else if (t <= 2.15d+167) then
        tmp = t_1 + t_2
    else
        tmp = t_3
    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 t_2 = x + (a * t);
	double t_3 = (z * y) + t_2;
	double tmp;
	if (t <= -7e-19) {
		tmp = t_3;
	} else if (t <= 3.4e-44) {
		tmp = (z * y) + (x + t_1);
	} else if (t <= 2.15e+167) {
		tmp = t_1 + t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = a * (z * b)
	t_2 = x + (a * t)
	t_3 = (z * y) + t_2
	tmp = 0
	if t <= -7e-19:
		tmp = t_3
	elif t <= 3.4e-44:
		tmp = (z * y) + (x + t_1)
	elif t <= 2.15e+167:
		tmp = t_1 + t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(z * b))
	t_2 = Float64(x + Float64(a * t))
	t_3 = Float64(Float64(z * y) + t_2)
	tmp = 0.0
	if (t <= -7e-19)
		tmp = t_3;
	elseif (t <= 3.4e-44)
		tmp = Float64(Float64(z * y) + Float64(x + t_1));
	elseif (t <= 2.15e+167)
		tmp = Float64(t_1 + t_2);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (z * b);
	t_2 = x + (a * t);
	t_3 = (z * y) + t_2;
	tmp = 0.0;
	if (t <= -7e-19)
		tmp = t_3;
	elseif (t <= 3.4e-44)
		tmp = (z * y) + (x + t_1);
	elseif (t <= 2.15e+167)
		tmp = t_1 + t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z * y), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[t, -7e-19], t$95$3, If[LessEqual[t, 3.4e-44], N[(N[(z * y), $MachinePrecision] + N[(x + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+167], N[(t$95$1 + t$95$2), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;z \cdot y + \left(x + t_1\right)\\

\mathbf{elif}\;t \leq 2.15 \cdot 10^{+167}:\\
\;\;\;\;t_1 + t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.00000000000000031e-19 or 2.1500000000000001e167 < t

    1. Initial program 94.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. *-commutative94.7%

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

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

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

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

    if -7.00000000000000031e-19 < t < 3.40000000000000016e-44

    1. Initial program 94.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+94.2%

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

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

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative94.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*95.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-out95.1%

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

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

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

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

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

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

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

    if 3.40000000000000016e-44 < t < 2.1500000000000001e167

    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. +-commutative86.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7 \cdot 10^{-19}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-44}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot \left(z \cdot b\right)\right)\\ \mathbf{elif}\;t \leq 2.15 \cdot 10^{+167}:\\ \;\;\;\;a \cdot \left(z \cdot b\right) + \left(x + a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \end{array} \]

Alternative 6: 93.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+119}:\\
\;\;\;\;a \cdot \left(z \cdot b\right) + \left(x + a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.59999999999999995e119

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999995e119 < a

    1. Initial program 95.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. *-commutative95.0%

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

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

      \[\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 simplification93.9%

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

Alternative 7: 85.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + a \cdot t\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{+45} \lor \neg \left(y \leq 2.4 \cdot 10^{+76}\right):\\ \;\;\;\;z \cdot y + t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot b\right) + t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* a t))))
   (if (or (<= y -2.2e+45) (not (<= y 2.4e+76)))
     (+ (* z y) t_1)
     (+ (* a (* z b)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (a * t);
	double tmp;
	if ((y <= -2.2e+45) || !(y <= 2.4e+76)) {
		tmp = (z * y) + t_1;
	} else {
		tmp = (a * (z * b)) + 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 = x + (a * t)
    if ((y <= (-2.2d+45)) .or. (.not. (y <= 2.4d+76))) then
        tmp = (z * y) + t_1
    else
        tmp = (a * (z * b)) + 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 = x + (a * t);
	double tmp;
	if ((y <= -2.2e+45) || !(y <= 2.4e+76)) {
		tmp = (z * y) + t_1;
	} else {
		tmp = (a * (z * b)) + t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (a * t)
	tmp = 0
	if (y <= -2.2e+45) or not (y <= 2.4e+76):
		tmp = (z * y) + t_1
	else:
		tmp = (a * (z * b)) + t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(a * t))
	tmp = 0.0
	if ((y <= -2.2e+45) || !(y <= 2.4e+76))
		tmp = Float64(Float64(z * y) + t_1);
	else
		tmp = Float64(Float64(a * Float64(z * b)) + t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (a * t);
	tmp = 0.0;
	if ((y <= -2.2e+45) || ~((y <= 2.4e+76)))
		tmp = (z * y) + t_1;
	else
		tmp = (a * (z * b)) + t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -2.2e+45], N[Not[LessEqual[y, 2.4e+76]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+45} \lor \neg \left(y \leq 2.4 \cdot 10^{+76}\right):\\
\;\;\;\;z \cdot y + t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.2e45 or 2.4e76 < y

    1. Initial program 90.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. *-commutative90.3%

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

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

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

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

    if -2.2e45 < y < 2.4e76

    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. +-commutative95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 55.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + a \cdot t\\ \mathbf{if}\;b \leq -1.5 \cdot 10^{+168}:\\ \;\;\;\;b \cdot \left(z \cdot a\right)\\ \mathbf{elif}\;b \leq -5.2 \cdot 10^{-213}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -1.5 \cdot 10^{-254}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(a \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* a t))))
   (if (<= b -1.5e+168)
     (* b (* z a))
     (if (<= b -5.2e-213)
       t_1
       (if (<= b -1.5e-254) (* z y) (if (<= b 2.8e+139) t_1 (* z (* a b))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (a * t);
	double tmp;
	if (b <= -1.5e+168) {
		tmp = b * (z * a);
	} else if (b <= -5.2e-213) {
		tmp = t_1;
	} else if (b <= -1.5e-254) {
		tmp = z * y;
	} else if (b <= 2.8e+139) {
		tmp = t_1;
	} else {
		tmp = 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) :: t_1
    real(8) :: tmp
    t_1 = x + (a * t)
    if (b <= (-1.5d+168)) then
        tmp = b * (z * a)
    else if (b <= (-5.2d-213)) then
        tmp = t_1
    else if (b <= (-1.5d-254)) then
        tmp = z * y
    else if (b <= 2.8d+139) then
        tmp = t_1
    else
        tmp = 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 t_1 = x + (a * t);
	double tmp;
	if (b <= -1.5e+168) {
		tmp = b * (z * a);
	} else if (b <= -5.2e-213) {
		tmp = t_1;
	} else if (b <= -1.5e-254) {
		tmp = z * y;
	} else if (b <= 2.8e+139) {
		tmp = t_1;
	} else {
		tmp = z * (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (a * t)
	tmp = 0
	if b <= -1.5e+168:
		tmp = b * (z * a)
	elif b <= -5.2e-213:
		tmp = t_1
	elif b <= -1.5e-254:
		tmp = z * y
	elif b <= 2.8e+139:
		tmp = t_1
	else:
		tmp = z * (a * b)
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(a * t))
	tmp = 0.0
	if (b <= -1.5e+168)
		tmp = Float64(b * Float64(z * a));
	elseif (b <= -5.2e-213)
		tmp = t_1;
	elseif (b <= -1.5e-254)
		tmp = Float64(z * y);
	elseif (b <= 2.8e+139)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(a * b));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (a * t);
	tmp = 0.0;
	if (b <= -1.5e+168)
		tmp = b * (z * a);
	elseif (b <= -5.2e-213)
		tmp = t_1;
	elseif (b <= -1.5e-254)
		tmp = z * y;
	elseif (b <= 2.8e+139)
		tmp = t_1;
	else
		tmp = z * (a * b);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.5e+168], N[(b * N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5.2e-213], t$95$1, If[LessEqual[b, -1.5e-254], N[(z * y), $MachinePrecision], If[LessEqual[b, 2.8e+139], t$95$1, N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;b \leq -1.5 \cdot 10^{+168}:\\
\;\;\;\;b \cdot \left(z \cdot a\right)\\

\mathbf{elif}\;b \leq -5.2 \cdot 10^{-213}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq -1.5 \cdot 10^{-254}:\\
\;\;\;\;z \cdot y\\

\mathbf{elif}\;b \leq 2.8 \cdot 10^{+139}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.4999999999999999e168

    1. Initial program 90.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. *-commutative90.6%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 66.6%

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

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

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]
    8. Taylor expanded in b around 0 66.6%

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

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

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

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

    if -1.4999999999999999e168 < b < -5.2000000000000003e-213 or -1.50000000000000006e-254 < b < 2.7999999999999998e139

    1. Initial program 94.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. *-commutative94.0%

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

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

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

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

    if -5.2000000000000003e-213 < b < -1.50000000000000006e-254

    1. Initial program 91.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. *-commutative91.7%

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

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

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

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative75.6%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified75.6%

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

    if 2.7999999999999998e139 < b

    1. Initial program 90.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. *-commutative90.2%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 61.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+168}:\\ \;\;\;\;b \cdot \left(z \cdot a\right)\\ \mathbf{elif}\;b \leq -5.2 \cdot 10^{-213}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;b \leq -1.5 \cdot 10^{-254}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{+139}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 9: 82.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+96} \lor \neg \left(a \leq 6.2 \cdot 10^{+30}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.9999999999999998e96 or 6.1999999999999995e30 < a

    1. Initial program 86.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. *-commutative86.4%

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

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

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

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

    if -6.9999999999999998e96 < a < 6.1999999999999995e30

    1. Initial program 98.5%

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

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

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

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

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

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

Alternative 10: 60.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(z \cdot b\right)\\ \mathbf{if}\;a \leq -2 \cdot 10^{+221}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.35 \cdot 10^{+63}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;a \leq 6.6 \cdot 10^{+30}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* z b))))
   (if (<= a -2e+221)
     t_1
     (if (<= a -1.35e+63)
       (+ x (* a t))
       (if (<= a 6.6e+30) (+ x (* z y)) 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 (a <= -2e+221) {
		tmp = t_1;
	} else if (a <= -1.35e+63) {
		tmp = x + (a * t);
	} else if (a <= 6.6e+30) {
		tmp = x + (z * y);
	} 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 (a <= (-2d+221)) then
        tmp = t_1
    else if (a <= (-1.35d+63)) then
        tmp = x + (a * t)
    else if (a <= 6.6d+30) then
        tmp = x + (z * y)
    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 (a <= -2e+221) {
		tmp = t_1;
	} else if (a <= -1.35e+63) {
		tmp = x + (a * t);
	} else if (a <= 6.6e+30) {
		tmp = x + (z * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = a * (z * b)
	tmp = 0
	if a <= -2e+221:
		tmp = t_1
	elif a <= -1.35e+63:
		tmp = x + (a * t)
	elif a <= 6.6e+30:
		tmp = x + (z * y)
	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 (a <= -2e+221)
		tmp = t_1;
	elseif (a <= -1.35e+63)
		tmp = Float64(x + Float64(a * t));
	elseif (a <= 6.6e+30)
		tmp = Float64(x + Float64(z * y));
	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 (a <= -2e+221)
		tmp = t_1;
	elseif (a <= -1.35e+63)
		tmp = x + (a * t);
	elseif (a <= 6.6e+30)
		tmp = x + (z * y);
	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[a, -2e+221], t$95$1, If[LessEqual[a, -1.35e+63], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.6e+30], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq -1.35 \cdot 10^{+63}:\\
\;\;\;\;x + a \cdot t\\

\mathbf{elif}\;a \leq 6.6 \cdot 10^{+30}:\\
\;\;\;\;x + z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.0000000000000001e221 or 6.60000000000000053e30 < a

    1. Initial program 86.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. *-commutative86.1%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 52.9%

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

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

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

    if -2.0000000000000001e221 < a < -1.35000000000000009e63

    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. *-commutative89.7%

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

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

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

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

    if -1.35000000000000009e63 < a < 6.60000000000000053e30

    1. Initial program 98.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2 \cdot 10^{+221}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;a \leq -1.35 \cdot 10^{+63}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;a \leq 6.6 \cdot 10^{+30}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \end{array} \]

Alternative 11: 74.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+49} \lor \neg \left(z \leq 5.3 \cdot 10^{-13}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5000000000000001e49 or 5.2999999999999996e-13 < z

    1. Initial program 87.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. *-commutative87.1%

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

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

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

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

    if -1.5000000000000001e49 < z < 5.2999999999999996e-13

    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. *-commutative98.4%

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

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

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

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

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

Alternative 12: 74.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.3 \cdot 10^{+63} \lor \neg \left(a \leq 66000000\right):\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= a -1.3e+63) (not (<= a 66000000.0)))
   (* a (+ t (* z b)))
   (+ x (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((a <= -1.3e+63) || !(a <= 66000000.0)) {
		tmp = a * (t + (z * b));
	} else {
		tmp = x + (z * y);
	}
	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.3d+63)) .or. (.not. (a <= 66000000.0d0))) then
        tmp = a * (t + (z * b))
    else
        tmp = x + (z * y)
    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.3e+63) || !(a <= 66000000.0)) {
		tmp = a * (t + (z * b));
	} else {
		tmp = x + (z * y);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (a <= -1.3e+63) or not (a <= 66000000.0):
		tmp = a * (t + (z * b))
	else:
		tmp = x + (z * y)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((a <= -1.3e+63) || !(a <= 66000000.0))
		tmp = Float64(a * Float64(t + Float64(z * b)));
	else
		tmp = Float64(x + Float64(z * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((a <= -1.3e+63) || ~((a <= 66000000.0)))
		tmp = a * (t + (z * b));
	else
		tmp = x + (z * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.3e+63], N[Not[LessEqual[a, 66000000.0]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+63} \lor \neg \left(a \leq 66000000\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.3000000000000001e63 or 6.6e7 < a

    1. Initial program 87.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. *-commutative87.6%

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

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

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

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

    if -1.3000000000000001e63 < a < 6.6e7

    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. *-commutative98.4%

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

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

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

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

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

Alternative 13: 38.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;z \leq -8 \cdot 10^{-238}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;z \leq 2.9 \cdot 10^{-15}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.99999999999999997e81 or 2.90000000000000019e-15 < z

    1. Initial program 85.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. *-commutative85.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*93.6%

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

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

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative41.1%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified41.1%

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

    if -2.99999999999999997e81 < z < -7.9999999999999999e-238

    1. Initial program 97.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. *-commutative97.0%

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

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

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

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

    if -7.9999999999999999e-238 < z < 2.90000000000000019e-15

    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. *-commutative99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+81}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-238}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]

Alternative 14: 38.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+34}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-237}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.7e+34)
   (* a (* z b))
   (if (<= z -1.06e-237) (* a t) (if (<= z 6.4e-15) x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.7e+34) {
		tmp = a * (z * b);
	} else if (z <= -1.06e-237) {
		tmp = a * t;
	} else if (z <= 6.4e-15) {
		tmp = x;
	} else {
		tmp = z * y;
	}
	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.7d+34)) then
        tmp = a * (z * b)
    else if (z <= (-1.06d-237)) then
        tmp = a * t
    else if (z <= 6.4d-15) then
        tmp = x
    else
        tmp = z * y
    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.7e+34) {
		tmp = a * (z * b);
	} else if (z <= -1.06e-237) {
		tmp = a * t;
	} else if (z <= 6.4e-15) {
		tmp = x;
	} else {
		tmp = z * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -1.7e+34:
		tmp = a * (z * b)
	elif z <= -1.06e-237:
		tmp = a * t
	elif z <= 6.4e-15:
		tmp = x
	else:
		tmp = z * y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -1.7e+34)
		tmp = Float64(a * Float64(z * b));
	elseif (z <= -1.06e-237)
		tmp = Float64(a * t);
	elseif (z <= 6.4e-15)
		tmp = x;
	else
		tmp = Float64(z * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -1.7e+34)
		tmp = a * (z * b);
	elseif (z <= -1.06e-237)
		tmp = a * t;
	elseif (z <= 6.4e-15)
		tmp = x;
	else
		tmp = z * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.7e+34], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.06e-237], N[(a * t), $MachinePrecision], If[LessEqual[z, 6.4e-15], x, N[(z * y), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.06 \cdot 10^{-237}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;z \leq 6.4 \cdot 10^{-15}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.7e34

    1. Initial program 81.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. *-commutative81.9%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 52.2%

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

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    7. Simplified52.2%

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

    if -1.7e34 < z < -1.05999999999999994e-237

    1. Initial program 98.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. *-commutative98.0%

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

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

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

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

    if -1.05999999999999994e-237 < z < 6.3999999999999999e-15

    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. *-commutative99.9%

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

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

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

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

    if 6.3999999999999999e-15 < z

    1. Initial program 90.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. *-commutative90.3%

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

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

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

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative45.7%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified45.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{+34}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-237}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]

Alternative 15: 39.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{+36}:\\ \;\;\;\;z \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-238}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.12e+36)
   (* z (* a b))
   (if (<= z -9.4e-238) (* a t) (if (<= z 4e-15) x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.12e+36) {
		tmp = z * (a * b);
	} else if (z <= -9.4e-238) {
		tmp = a * t;
	} else if (z <= 4e-15) {
		tmp = x;
	} else {
		tmp = z * y;
	}
	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.12d+36)) then
        tmp = z * (a * b)
    else if (z <= (-9.4d-238)) then
        tmp = a * t
    else if (z <= 4d-15) then
        tmp = x
    else
        tmp = z * y
    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.12e+36) {
		tmp = z * (a * b);
	} else if (z <= -9.4e-238) {
		tmp = a * t;
	} else if (z <= 4e-15) {
		tmp = x;
	} else {
		tmp = z * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -1.12e+36:
		tmp = z * (a * b)
	elif z <= -9.4e-238:
		tmp = a * t
	elif z <= 4e-15:
		tmp = x
	else:
		tmp = z * y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -1.12e+36)
		tmp = Float64(z * Float64(a * b));
	elseif (z <= -9.4e-238)
		tmp = Float64(a * t);
	elseif (z <= 4e-15)
		tmp = x;
	else
		tmp = Float64(z * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -1.12e+36)
		tmp = z * (a * b);
	elseif (z <= -9.4e-238)
		tmp = a * t;
	elseif (z <= 4e-15)
		tmp = x;
	else
		tmp = z * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.12e+36], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.4e-238], N[(a * t), $MachinePrecision], If[LessEqual[z, 4e-15], x, N[(z * y), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -9.4 \cdot 10^{-238}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;z \leq 4 \cdot 10^{-15}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.11999999999999999e36

    1. Initial program 81.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. *-commutative81.9%

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 54.0%

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

    if -1.11999999999999999e36 < z < -9.40000000000000046e-238

    1. Initial program 98.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. *-commutative98.0%

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

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

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

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

    if -9.40000000000000046e-238 < z < 4.0000000000000003e-15

    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. *-commutative99.9%

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

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

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

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

    if 4.0000000000000003e-15 < z

    1. Initial program 90.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. *-commutative90.3%

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

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

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

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative45.7%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified45.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.12 \cdot 10^{+36}:\\ \;\;\;\;z \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-238}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]

Alternative 16: 38.4% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-15}:\\
\;\;\;\;a \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.40000000000000007e-15 or 1.44999999999999996e-56 < t

    1. Initial program 92.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. *-commutative92.2%

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

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

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

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

    if -1.40000000000000007e-15 < t < 1.44999999999999996e-56

    1. Initial program 94.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. *-commutative94.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-15}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq 1.45 \cdot 10^{-56}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 17: 25.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.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. *-commutative93.0%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification25.9%

    \[\leadsto x \]

Developer target: 97.3% 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 2023268 
(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)))