Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.6% → 95.3%
Time: 9.5s
Alternatives: 11
Speedup: 1.6×

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 11 alternatives:

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

Initial Program: 92.6% accurate, 1.0× speedup?

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

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

Alternative 1: 95.3% accurate, 0.8× speedup?

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

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

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


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

    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. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e33 < b

    1. Initial program 100.0%

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

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

Alternative 2: 71.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.85 \cdot 10^{-123}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\

\mathbf{elif}\;z \leq 1.75 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot b, a, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.02e-14 or 1.7500000000000001e154 < z

    1. Initial program 88.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 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.f6486.8

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

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

    if -1.02e-14 < z < 2.85000000000000014e-123

    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 z around 0

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

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

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

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

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

    if 2.85000000000000014e-123 < z < 1.7500000000000001e154

    1. Initial program 96.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 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.f6483.6

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

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

      \[\leadsto \mathsf{fma}\left(b \cdot z, a, x\right) \]
    7. Step-by-step derivation
      1. Applied rewrites67.4%

        \[\leadsto \mathsf{fma}\left(b \cdot z, a, x\right) \]
    8. Recombined 3 regimes into one program.
    9. Final simplification78.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{elif}\;z \leq 2.85 \cdot 10^{-123}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(z \cdot b, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 86.6% accurate, 1.2× speedup?

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

      1. Initial program 93.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 b around 0

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

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

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

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

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

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

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

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

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

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

        if -1.1200000000000001e-23 < y < 7.50000000000000072e41

        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. 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.6

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

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

      Alternative 4: 81.6% accurate, 1.2× speedup?

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

        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 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.f6487.2

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

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

        if -0.110000000000000001 < z < 5.80000000000000021e156

        1. Initial program 98.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 b around 0

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)} \]
        6. Step-by-step derivation
          1. Applied rewrites82.2%

            \[\leadsto \mathsf{fma}\left(t, \color{blue}{a}, \mathsf{fma}\left(z, y, x\right)\right) \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 5: 73.2% accurate, 1.2× speedup?

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

          1. Initial program 90.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 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.f6483.4

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

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

          if -1.02e-14 < z < 4.99999999999999961e80

          1. Initial program 98.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 z around 0

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

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

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

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

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

        Alternative 6: 60.8% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+156}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b\right) \cdot z\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (<= z -1.2e-12) (fma z y x) (if (<= z 6e+156) (fma t a x) (* (* a b) z))))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if (z <= -1.2e-12) {
        		tmp = fma(z, y, x);
        	} else if (z <= 6e+156) {
        		tmp = fma(t, a, x);
        	} else {
        		tmp = (a * b) * z;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if (z <= -1.2e-12)
        		tmp = fma(z, y, x);
        	elseif (z <= 6e+156)
        		tmp = fma(t, a, x);
        	else
        		tmp = Float64(Float64(a * b) * z);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.2e-12], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 6e+156], N[(t * a + x), $MachinePrecision], N[(N[(a * b), $MachinePrecision] * z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -1.2 \cdot 10^{-12}:\\
        \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
        
        \mathbf{elif}\;z \leq 6 \cdot 10^{+156}:\\
        \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(a \cdot b\right) \cdot z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -1.19999999999999994e-12

          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 a around 0

            \[\leadsto \color{blue}{x + y \cdot z} \]
          4. 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.f6454.1

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

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

          if -1.19999999999999994e-12 < z < 5.9999999999999999e156

          1. Initial program 98.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 z around 0

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

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

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

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

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

          if 5.9999999999999999e156 < z

          1. Initial program 83.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 b around inf

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

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

              \[\leadsto \color{blue}{\left(b \cdot z\right) \cdot a} \]
            3. lower-*.f6450.1

              \[\leadsto \color{blue}{\left(b \cdot z\right)} \cdot a \]
          5. Applied rewrites50.1%

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+156}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b\right) \cdot z\\ \end{array} \]
          9. Add Preprocessing

          Alternative 7: 63.4% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -49:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;t \leq 2.5 \cdot 10^{+20}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \end{array} \end{array} \]
          (FPCore (x y z t a b)
           :precision binary64
           (if (<= t -49.0) (fma t a x) (if (<= t 2.5e+20) (fma z y x) (fma t a x))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double tmp;
          	if (t <= -49.0) {
          		tmp = fma(t, a, x);
          	} else if (t <= 2.5e+20) {
          		tmp = fma(z, y, x);
          	} else {
          		tmp = fma(t, a, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b)
          	tmp = 0.0
          	if (t <= -49.0)
          		tmp = fma(t, a, x);
          	elseif (t <= 2.5e+20)
          		tmp = fma(z, y, x);
          	else
          		tmp = fma(t, a, x);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -49.0], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 2.5e+20], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;t \leq -49:\\
          \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
          
          \mathbf{elif}\;t \leq 2.5 \cdot 10^{+20}:\\
          \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if t < -49 or 2.5e20 < t

            1. Initial program 94.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 z around 0

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

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

                \[\leadsto \color{blue}{t \cdot a} + x \]
              3. lower-fma.f6466.1

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

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

            if -49 < t < 2.5e20

            1. Initial program 94.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 a around 0

              \[\leadsto \color{blue}{x + y \cdot z} \]
            4. 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.f6459.5

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

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

          Alternative 8: 58.0% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{-11}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+158}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \end{array} \]
          (FPCore (x y z t a b)
           :precision binary64
           (if (<= z -1.4e-11) (* y z) (if (<= z 1.55e+158) (fma t a x) (* y z))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double tmp;
          	if (z <= -1.4e-11) {
          		tmp = y * z;
          	} else if (z <= 1.55e+158) {
          		tmp = fma(t, a, x);
          	} else {
          		tmp = y * z;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b)
          	tmp = 0.0
          	if (z <= -1.4e-11)
          		tmp = Float64(y * z);
          	elseif (z <= 1.55e+158)
          		tmp = fma(t, a, x);
          	else
          		tmp = Float64(y * z);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.4e-11], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.55e+158], N[(t * a + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1.4 \cdot 10^{-11}:\\
          \;\;\;\;y \cdot z\\
          
          \mathbf{elif}\;z \leq 1.55 \cdot 10^{+158}:\\
          \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1.4e-11 or 1.5500000000000001e158 < z

            1. Initial program 89.7%

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

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

                \[\leadsto \color{blue}{z \cdot y} \]
              2. lower-*.f6445.7

                \[\leadsto \color{blue}{z \cdot y} \]
            5. Applied rewrites45.7%

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

            if -1.4e-11 < z < 1.5500000000000001e158

            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
            3. Taylor expanded in z around 0

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

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{-11}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+158}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
          5. Add Preprocessing

          Alternative 9: 94.7% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), \mathsf{fma}\left(z, y, x\right)\right) \end{array} \]
          (FPCore (x y z t a b) :precision binary64 (fma a (fma b z t) (fma z y x)))
          double code(double x, double y, double z, double t, double a, double b) {
          	return fma(a, fma(b, z, t), fma(z, y, x));
          }
          
          function code(x, y, z, t, a, b)
          	return fma(a, fma(b, z, t), fma(z, y, x))
          end
          
          code[x_, y_, z_, t_, a_, b_] := N[(a * N[(b * z + t), $MachinePrecision] + N[(z * y + x), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), \mathsf{fma}\left(z, y, x\right)\right)
          \end{array}
          
          Derivation
          1. Initial program 94.7%

            \[\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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 10: 39.4% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{-12}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+106}:\\ \;\;\;\;t \cdot a\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \end{array} \]
          (FPCore (x y z t a b)
           :precision binary64
           (if (<= z -1.15e-12) (* y z) (if (<= z 7e+106) (* t a) (* y z))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double tmp;
          	if (z <= -1.15e-12) {
          		tmp = y * z;
          	} else if (z <= 7e+106) {
          		tmp = t * a;
          	} else {
          		tmp = y * z;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z, t, a, b)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: t
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8) :: tmp
              if (z <= (-1.15d-12)) then
                  tmp = y * z
              else if (z <= 7d+106) then
                  tmp = t * a
              else
                  tmp = y * z
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t, double a, double b) {
          	double tmp;
          	if (z <= -1.15e-12) {
          		tmp = y * z;
          	} else if (z <= 7e+106) {
          		tmp = t * a;
          	} else {
          		tmp = y * z;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t, a, b):
          	tmp = 0
          	if z <= -1.15e-12:
          		tmp = y * z
          	elif z <= 7e+106:
          		tmp = t * a
          	else:
          		tmp = y * z
          	return tmp
          
          function code(x, y, z, t, a, b)
          	tmp = 0.0
          	if (z <= -1.15e-12)
          		tmp = Float64(y * z);
          	elseif (z <= 7e+106)
          		tmp = Float64(t * a);
          	else
          		tmp = Float64(y * z);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t, a, b)
          	tmp = 0.0;
          	if (z <= -1.15e-12)
          		tmp = y * z;
          	elseif (z <= 7e+106)
          		tmp = t * a;
          	else
          		tmp = y * z;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.15e-12], N[(y * z), $MachinePrecision], If[LessEqual[z, 7e+106], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1.15 \cdot 10^{-12}:\\
          \;\;\;\;y \cdot z\\
          
          \mathbf{elif}\;z \leq 7 \cdot 10^{+106}:\\
          \;\;\;\;t \cdot a\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1.14999999999999995e-12 or 6.99999999999999962e106 < z

            1. Initial program 89.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 y around inf

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

                \[\leadsto \color{blue}{z \cdot y} \]
              2. lower-*.f6443.2

                \[\leadsto \color{blue}{z \cdot y} \]
            5. Applied rewrites43.2%

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

            if -1.14999999999999995e-12 < z < 6.99999999999999962e106

            1. Initial program 98.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 inf

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

                \[\leadsto \color{blue}{t \cdot a} \]
              2. lower-*.f6435.6

                \[\leadsto \color{blue}{t \cdot a} \]
            5. Applied rewrites35.6%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{-12}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+106}:\\ \;\;\;\;t \cdot a\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
          5. Add Preprocessing

          Alternative 11: 27.2% accurate, 5.0× speedup?

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

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

              \[\leadsto \color{blue}{t \cdot a} \]
            2. lower-*.f6426.4

              \[\leadsto \color{blue}{t \cdot a} \]
          5. Applied rewrites26.4%

            \[\leadsto \color{blue}{t \cdot a} \]
          6. Add Preprocessing

          Developer Target 1: 97.5% 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 2024243 
          (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)))