Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.8% → 97.2%
Time: 9.4s
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.8% 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: 97.2% accurate, 0.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.00000000000000004e-91

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000004e-91 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.5% accurate, 0.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 9.99999999999999953e157

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999953e157 < b

    1. Initial program 98.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.3%

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

Alternative 3: 94.9% accurate, 0.1× speedup?

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

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

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


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

    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. associate-+l+94.4%

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

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

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

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

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

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

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

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

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

    if 1.4999999999999999e219 < z

    1. Initial program 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot \left(z \cdot b\right) + x}\right) \]
    5. Step-by-step derivation
      1. associate-*r*99.8%

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

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

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

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

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

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

Alternative 4: 96.3% 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}:\\ \;\;\;\;x + 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 (+ x (* 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 = x + (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 = x + (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 = x + (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(x + 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 = x + (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[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $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}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\


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

    1. Initial program 98.2%

      \[\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 \color{blue}{\left(a \cdot z\right) \cdot b + \left(\left(x + y \cdot z\right) + t \cdot a\right)} \]
      2. +-commutative0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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}:\\ \;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\ \end{array} \]

Alternative 5: 38.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(z \cdot b\right)\\ \mathbf{if}\;t \leq -3.5 \cdot 10^{+133}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -2.65 \cdot 10^{+76}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -8.2 \cdot 10^{-288}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{-235}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;t \leq 9.6 \cdot 10^{-139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{-47}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* z b))))
   (if (<= t -3.5e+133)
     (* a t)
     (if (<= t -2.65e+76)
       x
       (if (<= t -1.4e+31)
         (* a t)
         (if (<= t -8.2e-288)
           x
           (if (<= t 1.1e-235)
             (* z y)
             (if (<= t 9.6e-139)
               t_1
               (if (<= t 1.35e-47) x (if (<= t 2.8e+43) t_1 (* a t)))))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (z * b);
	double tmp;
	if (t <= -3.5e+133) {
		tmp = a * t;
	} else if (t <= -2.65e+76) {
		tmp = x;
	} else if (t <= -1.4e+31) {
		tmp = a * t;
	} else if (t <= -8.2e-288) {
		tmp = x;
	} else if (t <= 1.1e-235) {
		tmp = z * y;
	} else if (t <= 9.6e-139) {
		tmp = t_1;
	} else if (t <= 1.35e-47) {
		tmp = x;
	} else if (t <= 2.8e+43) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = a * (z * b)
    if (t <= (-3.5d+133)) then
        tmp = a * t
    else if (t <= (-2.65d+76)) then
        tmp = x
    else if (t <= (-1.4d+31)) then
        tmp = a * t
    else if (t <= (-8.2d-288)) then
        tmp = x
    else if (t <= 1.1d-235) then
        tmp = z * y
    else if (t <= 9.6d-139) then
        tmp = t_1
    else if (t <= 1.35d-47) then
        tmp = x
    else if (t <= 2.8d+43) then
        tmp = t_1
    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 t_1 = a * (z * b);
	double tmp;
	if (t <= -3.5e+133) {
		tmp = a * t;
	} else if (t <= -2.65e+76) {
		tmp = x;
	} else if (t <= -1.4e+31) {
		tmp = a * t;
	} else if (t <= -8.2e-288) {
		tmp = x;
	} else if (t <= 1.1e-235) {
		tmp = z * y;
	} else if (t <= 9.6e-139) {
		tmp = t_1;
	} else if (t <= 1.35e-47) {
		tmp = x;
	} else if (t <= 2.8e+43) {
		tmp = t_1;
	} else {
		tmp = a * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = a * (z * b)
	tmp = 0
	if t <= -3.5e+133:
		tmp = a * t
	elif t <= -2.65e+76:
		tmp = x
	elif t <= -1.4e+31:
		tmp = a * t
	elif t <= -8.2e-288:
		tmp = x
	elif t <= 1.1e-235:
		tmp = z * y
	elif t <= 9.6e-139:
		tmp = t_1
	elif t <= 1.35e-47:
		tmp = x
	elif t <= 2.8e+43:
		tmp = t_1
	else:
		tmp = a * t
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(z * b))
	tmp = 0.0
	if (t <= -3.5e+133)
		tmp = Float64(a * t);
	elseif (t <= -2.65e+76)
		tmp = x;
	elseif (t <= -1.4e+31)
		tmp = Float64(a * t);
	elseif (t <= -8.2e-288)
		tmp = x;
	elseif (t <= 1.1e-235)
		tmp = Float64(z * y);
	elseif (t <= 9.6e-139)
		tmp = t_1;
	elseif (t <= 1.35e-47)
		tmp = x;
	elseif (t <= 2.8e+43)
		tmp = t_1;
	else
		tmp = Float64(a * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (z * b);
	tmp = 0.0;
	if (t <= -3.5e+133)
		tmp = a * t;
	elseif (t <= -2.65e+76)
		tmp = x;
	elseif (t <= -1.4e+31)
		tmp = a * t;
	elseif (t <= -8.2e-288)
		tmp = x;
	elseif (t <= 1.1e-235)
		tmp = z * y;
	elseif (t <= 9.6e-139)
		tmp = t_1;
	elseif (t <= 1.35e-47)
		tmp = x;
	elseif (t <= 2.8e+43)
		tmp = t_1;
	else
		tmp = a * t;
	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[t, -3.5e+133], N[(a * t), $MachinePrecision], If[LessEqual[t, -2.65e+76], x, If[LessEqual[t, -1.4e+31], N[(a * t), $MachinePrecision], If[LessEqual[t, -8.2e-288], x, If[LessEqual[t, 1.1e-235], N[(z * y), $MachinePrecision], If[LessEqual[t, 9.6e-139], t$95$1, If[LessEqual[t, 1.35e-47], x, If[LessEqual[t, 2.8e+43], t$95$1, N[(a * t), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -2.65 \cdot 10^{+76}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.4 \cdot 10^{+31}:\\
\;\;\;\;a \cdot t\\

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

\mathbf{elif}\;t \leq 1.1 \cdot 10^{-235}:\\
\;\;\;\;z \cdot y\\

\mathbf{elif}\;t \leq 9.6 \cdot 10^{-139}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 2.8 \cdot 10^{+43}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -3.4999999999999998e133 or -2.65000000000000008e76 < t < -1.40000000000000008e31 or 2.80000000000000019e43 < t

    1. Initial program 90.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+90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999998e133 < t < -2.65000000000000008e76 or -1.40000000000000008e31 < t < -8.20000000000000015e-288 or 9.60000000000000059e-139 < t < 1.3499999999999999e-47

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.20000000000000015e-288 < t < 1.09999999999999992e-235

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.09999999999999992e-235 < t < 9.60000000000000059e-139 or 1.3499999999999999e-47 < t < 2.80000000000000019e43

    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(y \cdot z + x\right)} + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right) \]
      3. associate-+l+94.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+133}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -2.65 \cdot 10^{+76}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -8.2 \cdot 10^{-288}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{-235}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;t \leq 9.6 \cdot 10^{-139}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{-47}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+43}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 6: 69.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + a \cdot t\\ t_2 := a \cdot \left(t + z \cdot b\right)\\ t_3 := x + z \cdot y\\ \mathbf{if}\;a \leq -6.5 \cdot 10^{+159}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -2.9 \cdot 10^{+20}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -2.2 \cdot 10^{-133}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq -1.9 \cdot 10^{-296}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3.65 \cdot 10^{+27}:\\ \;\;\;\;t_3\\ \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 (* a (+ t (* z b)))) (t_3 (+ x (* z y))))
   (if (<= a -6.5e+159)
     t_2
     (if (<= a -6.5e+82)
       t_1
       (if (<= a -2.9e+20)
         t_2
         (if (<= a -2.2e-133)
           t_3
           (if (<= a -1.9e-296) t_1 (if (<= a 3.65e+27) t_3 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 = a * (t + (z * b));
	double t_3 = x + (z * y);
	double tmp;
	if (a <= -6.5e+159) {
		tmp = t_2;
	} else if (a <= -6.5e+82) {
		tmp = t_1;
	} else if (a <= -2.9e+20) {
		tmp = t_2;
	} else if (a <= -2.2e-133) {
		tmp = t_3;
	} else if (a <= -1.9e-296) {
		tmp = t_1;
	} else if (a <= 3.65e+27) {
		tmp = t_3;
	} 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 = a * (t + (z * b))
    t_3 = x + (z * y)
    if (a <= (-6.5d+159)) then
        tmp = t_2
    else if (a <= (-6.5d+82)) then
        tmp = t_1
    else if (a <= (-2.9d+20)) then
        tmp = t_2
    else if (a <= (-2.2d-133)) then
        tmp = t_3
    else if (a <= (-1.9d-296)) then
        tmp = t_1
    else if (a <= 3.65d+27) then
        tmp = t_3
    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 = a * (t + (z * b));
	double t_3 = x + (z * y);
	double tmp;
	if (a <= -6.5e+159) {
		tmp = t_2;
	} else if (a <= -6.5e+82) {
		tmp = t_1;
	} else if (a <= -2.9e+20) {
		tmp = t_2;
	} else if (a <= -2.2e-133) {
		tmp = t_3;
	} else if (a <= -1.9e-296) {
		tmp = t_1;
	} else if (a <= 3.65e+27) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (a * t)
	t_2 = a * (t + (z * b))
	t_3 = x + (z * y)
	tmp = 0
	if a <= -6.5e+159:
		tmp = t_2
	elif a <= -6.5e+82:
		tmp = t_1
	elif a <= -2.9e+20:
		tmp = t_2
	elif a <= -2.2e-133:
		tmp = t_3
	elif a <= -1.9e-296:
		tmp = t_1
	elif a <= 3.65e+27:
		tmp = t_3
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(a * t))
	t_2 = Float64(a * Float64(t + Float64(z * b)))
	t_3 = Float64(x + Float64(z * y))
	tmp = 0.0
	if (a <= -6.5e+159)
		tmp = t_2;
	elseif (a <= -6.5e+82)
		tmp = t_1;
	elseif (a <= -2.9e+20)
		tmp = t_2;
	elseif (a <= -2.2e-133)
		tmp = t_3;
	elseif (a <= -1.9e-296)
		tmp = t_1;
	elseif (a <= 3.65e+27)
		tmp = t_3;
	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 = a * (t + (z * b));
	t_3 = x + (z * y);
	tmp = 0.0;
	if (a <= -6.5e+159)
		tmp = t_2;
	elseif (a <= -6.5e+82)
		tmp = t_1;
	elseif (a <= -2.9e+20)
		tmp = t_2;
	elseif (a <= -2.2e-133)
		tmp = t_3;
	elseif (a <= -1.9e-296)
		tmp = t_1;
	elseif (a <= 3.65e+27)
		tmp = t_3;
	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[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.5e+159], t$95$2, If[LessEqual[a, -6.5e+82], t$95$1, If[LessEqual[a, -2.9e+20], t$95$2, If[LessEqual[a, -2.2e-133], t$95$3, If[LessEqual[a, -1.9e-296], t$95$1, If[LessEqual[a, 3.65e+27], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq -6.5 \cdot 10^{+82}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq -2.9 \cdot 10^{+20}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;a \leq -2.2 \cdot 10^{-133}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;a \leq -1.9 \cdot 10^{-296}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 3.65 \cdot 10^{+27}:\\
\;\;\;\;t_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.5000000000000001e159 or -6.5000000000000003e82 < a < -2.9e20 or 3.6499999999999999e27 < a

    1. Initial program 90.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+90.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.5000000000000001e159 < a < -6.5000000000000003e82 or -2.2000000000000001e-133 < a < -1.9000000000000001e-296

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
    5. Step-by-step derivation
      1. *-commutative87.9%

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

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

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

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

    if -2.9e20 < a < -2.2000000000000001e-133 or -1.9000000000000001e-296 < a < 3.6499999999999999e27

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.5 \cdot 10^{+159}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{+82}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;a \leq -2.9 \cdot 10^{+20}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \mathbf{elif}\;a \leq -2.2 \cdot 10^{-133}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{elif}\;a \leq -1.9 \cdot 10^{-296}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;a \leq 3.65 \cdot 10^{+27}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \end{array} \]

Alternative 7: 93.9% accurate, 0.9× speedup?

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

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

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


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

    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. associate-+l+94.4%

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

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

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

    if 5.19999999999999998e213 < z

    1. Initial program 88.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. +-commutative88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 39.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq -2.6 \cdot 10^{+76}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.45 \cdot 10^{+29}:\\
\;\;\;\;a \cdot t\\

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

\mathbf{elif}\;t \leq 5.7 \cdot 10^{-177}:\\
\;\;\;\;z \cdot y\\

\mathbf{elif}\;t \leq 8.5 \cdot 10^{+51}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.4999999999999998e133 or -2.5999999999999999e76 < t < -1.45e29 or 8.4999999999999999e51 < t

    1. Initial program 90.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. associate-+l+90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999998e133 < t < -2.5999999999999999e76 or -1.45e29 < t < -8.4999999999999997e-288 or 5.6999999999999998e-177 < t < 8.4999999999999999e51

    1. Initial program 96.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+96.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
    5. Step-by-step derivation
      1. *-commutative77.4%

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

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

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

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

    if -8.4999999999999997e-288 < t < 5.6999999999999998e-177

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+133}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -2.6 \cdot 10^{+76}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.45 \cdot 10^{+29}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -8.5 \cdot 10^{-288}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 5.7 \cdot 10^{-177}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{+51}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 9: 73.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 3.7 \cdot 10^{+44}:\\
\;\;\;\;x + a \cdot t\\

\mathbf{elif}\;z \leq 3.05 \cdot 10^{+122} \lor \neg \left(z \leq 2.2 \cdot 10^{+193}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.05e9 or 3.7000000000000001e44 < z < 3.0499999999999999e122 or 2.19999999999999986e193 < z

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05e9 < z < 3.7000000000000001e44

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.0499999999999999e122 < z < 2.19999999999999986e193

    1. Initial program 80.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+80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{b \cdot \left(a \cdot z\right)} + x \]
      4. fma-def70.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a \cdot z, x\right)} \]
    7. Simplified70.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, a \cdot z, x\right)} \]
    8. Step-by-step derivation
      1. fma-udef70.1%

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(a \cdot b\right)} + x \]
    9. Applied egg-rr81.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1050000000:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+44}:\\ \;\;\;\;x + a \cdot t\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{+122} \lor \neg \left(z \leq 2.2 \cdot 10^{+193}\right):\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(a \cdot b\right)\\ \end{array} \]

Alternative 10: 80.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3600000000 \lor \neg \left(z \leq 3.6 \cdot 10^{+212}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.6e9 or 3.6e212 < z

    1. Initial program 87.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+87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6e9 < z < 3.6e212

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 86.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+60} \lor \neg \left(y \leq 9.8 \cdot 10^{+26}\right):\\
\;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.20000000000000016e60 or 9.79999999999999947e26 < y

    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. associate-+l+92.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.20000000000000016e60 < y < 9.79999999999999947e26

    1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 87.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-27} \lor \neg \left(z \leq 1.8 \cdot 10^{+40}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.30000000000000009e-27 or 1.79999999999999998e40 < z

    1. Initial program 88.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. +-commutative88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.30000000000000009e-27 < z < 1.79999999999999998e40

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 39.6% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;t \leq -2.1 \cdot 10^{+76}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.9 \cdot 10^{+25}:\\
\;\;\;\;a \cdot t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.4999999999999998e133 or -2.10000000000000007e76 < t < -1.9e25 or 9.1999999999999999e52 < t

    1. Initial program 90.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. associate-+l+90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999998e133 < t < -2.10000000000000007e76 or -1.9e25 < t < 9.1999999999999999e52

    1. Initial program 96.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+96.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
    5. Step-by-step derivation
      1. *-commutative76.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.5 \cdot 10^{+133}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq -2.1 \cdot 10^{+76}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{+25}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq 9.2 \cdot 10^{+52}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 14: 74.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2600000000 \lor \neg \left(z \leq 8.5 \cdot 10^{+43}\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 -2600000000.0) (not (<= z 8.5e+43)))
   (* 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 <= -2600000000.0) || !(z <= 8.5e+43)) {
		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 <= (-2600000000.0d0)) .or. (.not. (z <= 8.5d+43))) 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 <= -2600000000.0) || !(z <= 8.5e+43)) {
		tmp = z * (y + (a * b));
	} else {
		tmp = x + (a * t);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (z <= -2600000000.0) or not (z <= 8.5e+43):
		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 <= -2600000000.0) || !(z <= 8.5e+43))
		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 <= -2600000000.0) || ~((z <= 8.5e+43)))
		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, -2600000000.0], N[Not[LessEqual[z, 8.5e+43]], $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 -2600000000 \lor \neg \left(z \leq 8.5 \cdot 10^{+43}\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 < -2.6e9 or 8.5e43 < z

    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. associate-+l+87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6e9 < z < 8.5e43

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 64.6% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+40} \lor \neg \left(t \leq 8 \cdot 10^{+43}\right):\\
\;\;\;\;x + a \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.60000000000000009e40 or 8.00000000000000011e43 < t

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
    5. Step-by-step derivation
      1. *-commutative85.8%

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

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

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

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

    if -7.60000000000000009e40 < t < 8.00000000000000011e43

    1. Initial program 95.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+95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 59.0% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+213}:\\
\;\;\;\;x + a \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.99999999999999993e79

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999993e79 < z < 1.2499999999999999e213

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
    5. Step-by-step derivation
      1. *-commutative86.0%

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

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

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

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

    if 1.2499999999999999e213 < z

    1. Initial program 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y, z, \color{blue}{a \cdot t + x}\right) \]
  5. Step-by-step derivation
    1. *-commutative79.2%

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

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

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

    \[\leadsto \color{blue}{x} \]
  8. Final simplification29.5%

    \[\leadsto x \]

Developer target: 97.5% 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 2023221 
(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)))