Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.3% → 96.5%
Time: 7.8s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 92.3% accurate, 1.0× speedup?

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

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

Alternative 1: 96.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+199} \lor \neg \left(z \leq 6.8 \cdot 10^{+159}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(z, y, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= z -3.6e+199) (not (<= z 6.8e+159)))
   (fma (fma b a y) z x)
   (fma a (+ t (* b z)) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((z <= -3.6e+199) || !(z <= 6.8e+159)) {
		tmp = fma(fma(b, a, y), z, x);
	} else {
		tmp = fma(a, (t + (b * z)), fma(z, y, x));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((z <= -3.6e+199) || !(z <= 6.8e+159))
		tmp = fma(fma(b, a, y), z, x);
	else
		tmp = fma(a, Float64(t + Float64(b * z)), fma(z, y, x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.6e+199], N[Not[LessEqual[z, 6.8e+159]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision] + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+199} \lor \neg \left(z \leq 6.8 \cdot 10^{+159}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.60000000000000001e199 or 6.79999999999999983e159 < z

    1. Initial program 84.4%

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

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

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

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

        \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
      4. distribute-rgt-inN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
      7. +-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
    5. Applied rewrites98.2%

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

    if -3.60000000000000001e199 < z < 6.79999999999999983e159

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot t + \color{blue}{\left(a \cdot z\right)} \cdot b\right) + \left(x + y \cdot z\right) \]
      9. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + z \cdot b, x + y \cdot z\right)} \]
      12. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(a, \color{blue}{t + z \cdot b}, x + y \cdot z\right) \]
      13. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(a, t + \color{blue}{b \cdot z}, x + y \cdot z\right) \]
      15. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(a, t + b \cdot z, \color{blue}{x + y \cdot z}\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a, t + b \cdot z, \color{blue}{y \cdot z + x}\right) \]
      17. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a, t + b \cdot z, \color{blue}{y \cdot z} + x\right) \]
      18. *-commutativeN/A

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+199} \lor \neg \left(z \leq 6.8 \cdot 10^{+159}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(z, y, x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 96.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.6%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Add Preprocessing

    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. Add Preprocessing
    3. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(t + b \cdot z\right) \cdot a} \]
      2. lower-*.f64N/A

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

        \[\leadsto \color{blue}{\left(b \cdot z + t\right)} \cdot a \]
      4. lower-fma.f6490.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, z, t\right)} \cdot a \]
    5. Applied rewrites90.9%

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

Alternative 3: 62.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a \cdot b, z, x\right)\\ \mathbf{if}\;t \leq -3.9 \cdot 10^{+132}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \mathbf{elif}\;t \leq -2.15 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;t \leq 1.95 \cdot 10^{-243}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{-138}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+80}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fma (* a b) z x)))
   (if (<= t -3.9e+132)
     (fma a t x)
     (if (<= t -2.15e+21)
       (fma z y x)
       (if (<= t 1.95e-243)
         t_1
         (if (<= t 4.8e-138)
           (fma z y x)
           (if (<= t 3.4e+80) t_1 (fma a t x))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma((a * b), z, x);
	double tmp;
	if (t <= -3.9e+132) {
		tmp = fma(a, t, x);
	} else if (t <= -2.15e+21) {
		tmp = fma(z, y, x);
	} else if (t <= 1.95e-243) {
		tmp = t_1;
	} else if (t <= 4.8e-138) {
		tmp = fma(z, y, x);
	} else if (t <= 3.4e+80) {
		tmp = t_1;
	} else {
		tmp = fma(a, t, x);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fma(Float64(a * b), z, x)
	tmp = 0.0
	if (t <= -3.9e+132)
		tmp = fma(a, t, x);
	elseif (t <= -2.15e+21)
		tmp = fma(z, y, x);
	elseif (t <= 1.95e-243)
		tmp = t_1;
	elseif (t <= 4.8e-138)
		tmp = fma(z, y, x);
	elseif (t <= 3.4e+80)
		tmp = t_1;
	else
		tmp = fma(a, t, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[t, -3.9e+132], N[(a * t + x), $MachinePrecision], If[LessEqual[t, -2.15e+21], N[(z * y + x), $MachinePrecision], If[LessEqual[t, 1.95e-243], t$95$1, If[LessEqual[t, 4.8e-138], N[(z * y + x), $MachinePrecision], If[LessEqual[t, 3.4e+80], t$95$1, N[(a * t + x), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a \cdot b, z, x\right)\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\

\mathbf{elif}\;t \leq -2.15 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\

\mathbf{elif}\;t \leq 1.95 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 4.8 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\

\mathbf{elif}\;t \leq 3.4 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.90000000000000001e132 or 3.39999999999999992e80 < t

    1. Initial program 92.6%

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

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

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

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

        \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
      4. distribute-rgt-inN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
      7. +-commutativeN/A

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

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

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

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

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

        \[\leadsto \color{blue}{a \cdot t + x} \]
      2. lower-fma.f6474.6

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

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

    if -3.90000000000000001e132 < t < -2.15e21 or 1.95000000000000008e-243 < t < 4.7999999999999998e-138

    1. Initial program 94.9%

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

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

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

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

        \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
      4. distribute-rgt-inN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
      7. +-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
    5. Applied rewrites93.1%

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

      \[\leadsto \color{blue}{x + y \cdot z} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{y \cdot z + x} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot y} + x \]
      3. lower-fma.f6479.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
    8. Applied rewrites79.7%

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

    if -2.15e21 < t < 1.95000000000000008e-243 or 4.7999999999999998e-138 < t < 3.39999999999999992e80

    1. Initial program 93.3%

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

      \[\leadsto \color{blue}{x + \left(a \cdot t + a \cdot \left(b \cdot z\right)\right)} \]
    4. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, z, t\right)}, a, x\right) \]
    5. Applied rewrites81.0%

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

      \[\leadsto x + \color{blue}{a \cdot \left(b \cdot z\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites78.8%

        \[\leadsto \mathsf{fma}\left(a \cdot b, \color{blue}{z}, x\right) \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 4: 63.3% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, t, z \cdot y\right)\\ \mathbf{if}\;y \leq -6 \cdot 10^{+160}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-186}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-20}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot b, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (fma a t (* z y))))
       (if (<= y -6e+160)
         t_1
         (if (<= y -2.7e-186)
           (fma a t x)
           (if (<= y 3.8e-20) (fma (* a b) z x) t_1)))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = fma(a, t, (z * y));
    	double tmp;
    	if (y <= -6e+160) {
    		tmp = t_1;
    	} else if (y <= -2.7e-186) {
    		tmp = fma(a, t, x);
    	} else if (y <= 3.8e-20) {
    		tmp = fma((a * b), z, x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	t_1 = fma(a, t, Float64(z * y))
    	tmp = 0.0
    	if (y <= -6e+160)
    		tmp = t_1;
    	elseif (y <= -2.7e-186)
    		tmp = fma(a, t, x);
    	elseif (y <= 3.8e-20)
    		tmp = fma(Float64(a * b), z, x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * t + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6e+160], t$95$1, If[LessEqual[y, -2.7e-186], N[(a * t + x), $MachinePrecision], If[LessEqual[y, 3.8e-20], N[(N[(a * b), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(a, t, z \cdot y\right)\\
    \mathbf{if}\;y \leq -6 \cdot 10^{+160}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq -2.7 \cdot 10^{-186}:\\
    \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
    
    \mathbf{elif}\;y \leq 3.8 \cdot 10^{-20}:\\
    \;\;\;\;\mathsf{fma}\left(a \cdot b, z, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -5.9999999999999997e160 or 3.7999999999999998e-20 < y

      1. Initial program 92.5%

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

        \[\leadsto \color{blue}{a \cdot t} \]
      4. Step-by-step derivation
        1. lower-*.f6425.0

          \[\leadsto \color{blue}{a \cdot t} \]
      5. Applied rewrites25.0%

        \[\leadsto \color{blue}{a \cdot t} \]
      6. Taylor expanded in x around 0

        \[\leadsto \color{blue}{a \cdot t + \left(a \cdot \left(b \cdot z\right) + y \cdot z\right)} \]
      7. Step-by-step derivation
        1. associate-+r+N/A

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{z \cdot b} + t, a, y \cdot z\right) \]
        7. lower-fma.f64N/A

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

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

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

        \[\leadsto a \cdot t + \color{blue}{y \cdot z} \]
      10. Step-by-step derivation
        1. Applied rewrites75.6%

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

        if -5.9999999999999997e160 < y < -2.6999999999999999e-186

        1. Initial program 98.3%

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

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

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

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

            \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
          4. distribute-rgt-inN/A

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
          7. +-commutativeN/A

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
        5. Applied rewrites66.8%

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

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

            \[\leadsto \color{blue}{a \cdot t + x} \]
          2. lower-fma.f6471.2

            \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
        8. Applied rewrites71.2%

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

        if -2.6999999999999999e-186 < y < 3.7999999999999998e-20

        1. Initial program 91.3%

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

          \[\leadsto \color{blue}{x + \left(a \cdot t + a \cdot \left(b \cdot z\right)\right)} \]
        4. Step-by-step derivation
          1. distribute-lft-inN/A

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, z, t\right)}, a, x\right) \]
        5. Applied rewrites89.4%

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

          \[\leadsto x + \color{blue}{a \cdot \left(b \cdot z\right)} \]
        7. Step-by-step derivation
          1. Applied rewrites79.9%

            \[\leadsto \mathsf{fma}\left(a \cdot b, \color{blue}{z}, x\right) \]
        8. Recombined 3 regimes into one program.
        9. Add Preprocessing

        Alternative 5: 86.0% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+108} \lor \neg \left(z \leq 1.2 \cdot 10^{-50}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= z -7.5e+108) (not (<= z 1.2e-50)))
           (fma (fma b a y) z x)
           (fma (fma b z t) a x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((z <= -7.5e+108) || !(z <= 1.2e-50)) {
        		tmp = fma(fma(b, a, y), z, x);
        	} else {
        		tmp = fma(fma(b, z, t), a, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((z <= -7.5e+108) || !(z <= 1.2e-50))
        		tmp = fma(fma(b, a, y), z, x);
        	else
        		tmp = fma(fma(b, z, t), a, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.5e+108], N[Not[LessEqual[z, 1.2e-50]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -7.5 \cdot 10^{+108} \lor \neg \left(z \leq 1.2 \cdot 10^{-50}\right):\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -7.50000000000000039e108 or 1.20000000000000001e-50 < z

          1. Initial program 86.8%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites93.9%

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

          if -7.50000000000000039e108 < z < 1.20000000000000001e-50

          1. Initial program 99.2%

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

            \[\leadsto \color{blue}{x + \left(a \cdot t + a \cdot \left(b \cdot z\right)\right)} \]
          4. Step-by-step derivation
            1. distribute-lft-inN/A

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, z, t\right)}, a, x\right) \]
          5. Applied rewrites88.7%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+108} \lor \neg \left(z \leq 1.2 \cdot 10^{-50}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 82.5% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{-48} \lor \neg \left(z \leq 1.95 \cdot 10^{-150}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= z -2.55e-48) (not (<= z 1.95e-150)))
           (fma (fma b a y) z x)
           (fma a t x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((z <= -2.55e-48) || !(z <= 1.95e-150)) {
        		tmp = fma(fma(b, a, y), z, x);
        	} else {
        		tmp = fma(a, t, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((z <= -2.55e-48) || !(z <= 1.95e-150))
        		tmp = fma(fma(b, a, y), z, x);
        	else
        		tmp = fma(a, t, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.55e-48], N[Not[LessEqual[z, 1.95e-150]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -2.55 \cdot 10^{-48} \lor \neg \left(z \leq 1.95 \cdot 10^{-150}\right):\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -2.55000000000000006e-48 or 1.9500000000000001e-150 < z

          1. Initial program 90.7%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites89.7%

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

          if -2.55000000000000006e-48 < z < 1.9500000000000001e-150

          1. Initial program 98.9%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

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

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

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

              \[\leadsto \color{blue}{a \cdot t + x} \]
            2. lower-fma.f6487.7

              \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
          8. Applied rewrites87.7%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.55 \cdot 10^{-48} \lor \neg \left(z \leq 1.95 \cdot 10^{-150}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 7: 73.8% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -4.6 \cdot 10^{-31} \lor \neg \left(a \leq 4 \cdot 10^{+72}\right):\\ \;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= a -4.6e-31) (not (<= a 4e+72))) (* (fma b z t) a) (fma z y x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((a <= -4.6e-31) || !(a <= 4e+72)) {
        		tmp = fma(b, z, t) * a;
        	} else {
        		tmp = fma(z, y, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((a <= -4.6e-31) || !(a <= 4e+72))
        		tmp = Float64(fma(b, z, t) * a);
        	else
        		tmp = fma(z, y, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -4.6e-31], N[Not[LessEqual[a, 4e+72]], $MachinePrecision]], N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision], N[(z * y + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -4.6 \cdot 10^{-31} \lor \neg \left(a \leq 4 \cdot 10^{+72}\right):\\
        \;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < -4.5999999999999997e-31 or 3.99999999999999978e72 < a

          1. Initial program 88.3%

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

            \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(t + b \cdot z\right) \cdot a} \]
            2. lower-*.f64N/A

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

              \[\leadsto \color{blue}{\left(b \cdot z + t\right)} \cdot a \]
            4. lower-fma.f6480.5

              \[\leadsto \color{blue}{\mathsf{fma}\left(b, z, t\right)} \cdot a \]
          5. Applied rewrites80.5%

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

          if -4.5999999999999997e-31 < a < 3.99999999999999978e72

          1. Initial program 98.4%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites90.7%

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

            \[\leadsto \color{blue}{x + y \cdot z} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{y \cdot z + x} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{z \cdot y} + x \]
            3. lower-fma.f6478.0

              \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
          8. Applied rewrites78.0%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4.6 \cdot 10^{-31} \lor \neg \left(a \leq 4 \cdot 10^{+72}\right):\\ \;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 8: 74.6% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{-16}\right):\\ \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= z -4.5e-30) (not (<= z 2.6e-16))) (* (fma b a y) z) (fma a t x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((z <= -4.5e-30) || !(z <= 2.6e-16)) {
        		tmp = fma(b, a, y) * z;
        	} else {
        		tmp = fma(a, t, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((z <= -4.5e-30) || !(z <= 2.6e-16))
        		tmp = Float64(fma(b, a, y) * z);
        	else
        		tmp = fma(a, t, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.5e-30], N[Not[LessEqual[z, 2.6e-16]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -4.5 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{-16}\right):\\
        \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -4.49999999999999967e-30 or 2.5999999999999998e-16 < z

          1. Initial program 88.8%

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

            \[\leadsto \color{blue}{z \cdot \left(y + a \cdot b\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(y + a \cdot b\right) \cdot z} \]
            2. lower-*.f64N/A

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

              \[\leadsto \color{blue}{\left(a \cdot b + y\right)} \cdot z \]
            4. *-commutativeN/A

              \[\leadsto \left(\color{blue}{b \cdot a} + y\right) \cdot z \]
            5. lower-fma.f6477.1

              \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, y\right)} \cdot z \]
          5. Applied rewrites77.1%

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

          if -4.49999999999999967e-30 < z < 2.5999999999999998e-16

          1. Initial program 99.1%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites62.1%

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

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

              \[\leadsto \color{blue}{a \cdot t + x} \]
            2. lower-fma.f6480.0

              \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
          8. Applied rewrites80.0%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{-16}\right):\\ \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 9: 62.6% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 6.4 \cdot 10^{+134}\right):\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= t -3.9e+132) (not (<= t 6.4e+134))) (fma a t x) (fma z y x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((t <= -3.9e+132) || !(t <= 6.4e+134)) {
        		tmp = fma(a, t, x);
        	} else {
        		tmp = fma(z, y, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((t <= -3.9e+132) || !(t <= 6.4e+134))
        		tmp = fma(a, t, x);
        	else
        		tmp = fma(z, y, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.9e+132], N[Not[LessEqual[t, 6.4e+134]], $MachinePrecision]], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 6.4 \cdot 10^{+134}\right):\\
        \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -3.90000000000000001e132 or 6.4000000000000001e134 < t

          1. Initial program 92.0%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites53.2%

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

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

              \[\leadsto \color{blue}{a \cdot t + x} \]
            2. lower-fma.f6476.8

              \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
          8. Applied rewrites76.8%

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

          if -3.90000000000000001e132 < t < 6.4000000000000001e134

          1. Initial program 94.2%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites91.7%

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

            \[\leadsto \color{blue}{x + y \cdot z} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{y \cdot z + x} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{z \cdot y} + x \]
            3. lower-fma.f6462.3

              \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
          8. Applied rewrites62.3%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 6.4 \cdot 10^{+134}\right):\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 10: 58.5% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+163} \lor \neg \left(y \leq 1.4 \cdot 10^{+140}\right):\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= y -1.9e+163) (not (<= y 1.4e+140))) (* z y) (fma a t x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((y <= -1.9e+163) || !(y <= 1.4e+140)) {
        		tmp = z * y;
        	} else {
        		tmp = fma(a, t, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((y <= -1.9e+163) || !(y <= 1.4e+140))
        		tmp = Float64(z * y);
        	else
        		tmp = fma(a, t, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.9e+163], N[Not[LessEqual[y, 1.4e+140]], $MachinePrecision]], N[(z * y), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -1.9 \cdot 10^{+163} \lor \neg \left(y \leq 1.4 \cdot 10^{+140}\right):\\
        \;\;\;\;z \cdot y\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -1.90000000000000004e163 or 1.39999999999999991e140 < y

          1. Initial program 93.5%

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

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

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

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

              \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
            4. distribute-rgt-inN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
            7. +-commutativeN/A

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
          5. Applied rewrites82.4%

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

            \[\leadsto \color{blue}{x + y \cdot z} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{y \cdot z + x} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{z \cdot y} + x \]
            3. lower-fma.f6473.4

              \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
          8. Applied rewrites73.4%

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

            \[\leadsto y \cdot \color{blue}{z} \]
          10. Step-by-step derivation
            1. Applied rewrites63.4%

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

            if -1.90000000000000004e163 < y < 1.39999999999999991e140

            1. Initial program 93.4%

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

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

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

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

                \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
              4. distribute-rgt-inN/A

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
              7. +-commutativeN/A

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
            5. Applied rewrites76.9%

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

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

                \[\leadsto \color{blue}{a \cdot t + x} \]
              2. lower-fma.f6461.2

                \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
            8. Applied rewrites61.2%

              \[\leadsto \color{blue}{\mathsf{fma}\left(a, t, x\right)} \]
          11. Recombined 2 regimes into one program.
          12. Final simplification61.8%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+163} \lor \neg \left(y \leq 1.4 \cdot 10^{+140}\right):\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t, x\right)\\ \end{array} \]
          13. Add Preprocessing

          Alternative 11: 38.4% accurate, 1.7× speedup?

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

            1. Initial program 92.0%

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

              \[\leadsto \color{blue}{a \cdot t} \]
            4. Step-by-step derivation
              1. lower-*.f6459.0

                \[\leadsto \color{blue}{a \cdot t} \]
            5. Applied rewrites59.0%

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

            if -3.90000000000000001e132 < t < 1.05000000000000005e135

            1. Initial program 94.2%

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

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

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

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

                \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
              4. distribute-rgt-inN/A

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
              7. +-commutativeN/A

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, a, y\right)}, z, x\right) \]
            5. Applied rewrites91.7%

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

              \[\leadsto \color{blue}{x + y \cdot z} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{y \cdot z + x} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{z \cdot y} + x \]
              3. lower-fma.f6462.3

                \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
            8. Applied rewrites62.3%

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

              \[\leadsto y \cdot \color{blue}{z} \]
            10. Step-by-step derivation
              1. Applied rewrites32.4%

                \[\leadsto z \cdot \color{blue}{y} \]
            11. Recombined 2 regimes into one program.
            12. Final simplification41.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 1.05 \cdot 10^{+135}\right):\\ \;\;\;\;a \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
            13. Add Preprocessing

            Alternative 12: 28.7% accurate, 5.0× speedup?

            \[\begin{array}{l} \\ z \cdot y \end{array} \]
            (FPCore (x y z t a b) :precision binary64 (* z y))
            double code(double x, double y, double z, double t, double a, double b) {
            	return z * y;
            }
            
            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 = z * y
            end function
            
            public static double code(double x, double y, double z, double t, double a, double b) {
            	return z * y;
            }
            
            def code(x, y, z, t, a, b):
            	return z * y
            
            function code(x, y, z, t, a, b)
            	return Float64(z * y)
            end
            
            function tmp = code(x, y, z, t, a, b)
            	tmp = z * y;
            end
            
            code[x_, y_, z_, t_, a_, b_] := N[(z * y), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            z \cdot y
            \end{array}
            
            Derivation
            1. Initial program 93.4%

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

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

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

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

                \[\leadsto \left(y \cdot z + \color{blue}{\left(a \cdot b\right) \cdot z}\right) + x \]
              4. distribute-rgt-inN/A

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(y + a \cdot b, z, x\right)} \]
              7. +-commutativeN/A

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

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

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

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

              \[\leadsto \color{blue}{x + y \cdot z} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{y \cdot z + x} \]
              2. *-commutativeN/A

                \[\leadsto \color{blue}{z \cdot y} + x \]
              3. lower-fma.f6453.7

                \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
            8. Applied rewrites53.7%

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

              \[\leadsto y \cdot \color{blue}{z} \]
            10. Step-by-step derivation
              1. Applied rewrites28.3%

                \[\leadsto z \cdot \color{blue}{y} \]
              2. Add Preprocessing

              Developer Target 1: 97.3% accurate, 0.8× 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 2024324 
              (FPCore (x y z t a b)
                :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
                :precision binary64
              
                :alt
                (! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
              
                (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))