Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.5% → 95.2%
Time: 8.1s
Alternatives: 12
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 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.5% 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.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -5.00000000000000016e138

    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

    if -5.00000000000000016e138 < b

    1. Initial program 90.3%

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

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

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

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

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

Alternative 2: 85.9% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.4000000000000001e-37

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

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

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

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

      if -1.4000000000000001e-37 < y < 7.49999999999999989e83

      1. Initial program 91.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 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.f6491.2

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

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

      if 7.49999999999999989e83 < y

      1. Initial program 91.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 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.f6486.9

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

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

    Alternative 3: 73.5% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\ \mathbf{if}\;a \leq -5.8 \cdot 10^{+77}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 7 \cdot 10^{-31}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* (fma b z t) a)))
       (if (<= a -5.8e+77) t_1 (if (<= a 7e-31) (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, z, t) * a;
    	double tmp;
    	if (a <= -5.8e+77) {
    		tmp = t_1;
    	} else if (a <= 7e-31) {
    		tmp = fma(z, y, x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(fma(b, z, t) * a)
    	tmp = 0.0
    	if (a <= -5.8e+77)
    		tmp = t_1;
    	elseif (a <= 7e-31)
    		tmp = 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 * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -5.8e+77], t$95$1, If[LessEqual[a, 7e-31], N[(z * y + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\
    \mathbf{if}\;a \leq -5.8 \cdot 10^{+77}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 7 \cdot 10^{-31}:\\
    \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -5.8000000000000003e77 or 6.99999999999999971e-31 < a

      1. Initial program 85.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 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.f6479.4

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

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

      if -5.8000000000000003e77 < a < 6.99999999999999971e-31

      1. Initial program 96.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 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.f6478.9

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

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

    Alternative 4: 74.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.95 \cdot 10^{-22}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+18}:\\ \;\;\;\;\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.95e-22) t_1 (if (<= z 2.8e+18) (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.95e-22) {
    		tmp = t_1;
    	} else if (z <= 2.8e+18) {
    		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.95e-22)
    		tmp = t_1;
    	elseif (z <= 2.8e+18)
    		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.95e-22], t$95$1, If[LessEqual[z, 2.8e+18], 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.95 \cdot 10^{-22}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 2.8 \cdot 10^{+18}:\\
    \;\;\;\;\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.94999999999999999e-22 or 2.8e18 < z

      1. Initial program 86.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 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.f6471.8

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

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

      if -1.94999999999999999e-22 < z < 2.8e18

      1. Initial program 97.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 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.f6479.3

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

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

    Alternative 5: 61.2% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -4 \cdot 10^{+81}:\\ \;\;\;\;\left(z \cdot b\right) \cdot a\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-57}:\\ \;\;\;\;\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 (<= a -4e+81) (* (* z b) a) (if (<= a 1.6e-57) (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 (a <= -4e+81) {
    		tmp = (z * b) * a;
    	} else if (a <= 1.6e-57) {
    		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 (a <= -4e+81)
    		tmp = Float64(Float64(z * b) * a);
    	elseif (a <= 1.6e-57)
    		tmp = fma(z, y, x);
    	else
    		tmp = fma(t, a, x);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -4e+81], N[(N[(z * b), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[a, 1.6e-57], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -4 \cdot 10^{+81}:\\
    \;\;\;\;\left(z \cdot b\right) \cdot a\\
    
    \mathbf{elif}\;a \leq 1.6 \cdot 10^{-57}:\\
    \;\;\;\;\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 3 regimes
    2. if a < -3.99999999999999969e81

      1. Initial program 80.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 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-*.f6456.2

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

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

      if -3.99999999999999969e81 < a < 1.6e-57

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

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

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

      if 1.6e-57 < a

      1. Initial program 89.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.f6458.5

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

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

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

    Alternative 6: 60.8% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.65 \cdot 10^{+81}:\\ \;\;\;\;\left(a \cdot b\right) \cdot z\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-57}:\\ \;\;\;\;\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 (<= a -3.65e+81)
       (* (* a b) z)
       (if (<= a 1.6e-57) (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 (a <= -3.65e+81) {
    		tmp = (a * b) * z;
    	} else if (a <= 1.6e-57) {
    		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 (a <= -3.65e+81)
    		tmp = Float64(Float64(a * b) * z);
    	elseif (a <= 1.6e-57)
    		tmp = fma(z, y, x);
    	else
    		tmp = fma(t, a, x);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.65e+81], N[(N[(a * b), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[a, 1.6e-57], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -3.65 \cdot 10^{+81}:\\
    \;\;\;\;\left(a \cdot b\right) \cdot z\\
    
    \mathbf{elif}\;a \leq 1.6 \cdot 10^{-57}:\\
    \;\;\;\;\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 3 regimes
    2. if a < -3.6499999999999998e81

      1. Initial program 80.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 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-*.f6456.2

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

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

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

        if -3.6499999999999998e81 < a < 1.6e-57

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

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

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

        if 1.6e-57 < a

        1. Initial program 89.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.f6458.5

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(t, a, x\right)} \]
      7. Recombined 3 regimes into one program.
      8. Final simplification68.1%

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

      Alternative 7: 63.0% accurate, 1.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+24}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+82}:\\ \;\;\;\;\mathsf{fma}\left(t, a, 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 (<= y -2.9e+24) (fma z y x) (if (<= y 2.2e+82) (fma t a x) (fma z y x))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double tmp;
      	if (y <= -2.9e+24) {
      		tmp = fma(z, y, x);
      	} else if (y <= 2.2e+82) {
      		tmp = fma(t, a, x);
      	} else {
      		tmp = fma(z, y, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	tmp = 0.0
      	if (y <= -2.9e+24)
      		tmp = fma(z, y, x);
      	elseif (y <= 2.2e+82)
      		tmp = fma(t, a, x);
      	else
      		tmp = fma(z, y, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.9e+24], N[(z * y + x), $MachinePrecision], If[LessEqual[y, 2.2e+82], N[(t * a + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -2.9 \cdot 10^{+24}:\\
      \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
      
      \mathbf{elif}\;y \leq 2.2 \cdot 10^{+82}:\\
      \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -2.89999999999999979e24 or 2.2000000000000001e82 < y

        1. Initial program 89.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 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.f6472.6

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

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

        if -2.89999999999999979e24 < y < 2.2000000000000001e82

        1. Initial program 92.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 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.f6464.0

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

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

      Alternative 8: 80.3% accurate, 1.6× speedup?

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

        1. Initial program 80.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 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.f6486.3

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

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

        if -3.99999999999999969e81 < a

        1. Initial program 94.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.f6482.4

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

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

            \[\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 9: 94.6% 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 91.5%

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

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

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

          \[\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: 38.8% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.25 \cdot 10^{+29}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+82}:\\ \;\;\;\;a \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (<= y -1.25e+29) (* z y) (if (<= y 2.3e+82) (* a t) (* z y))))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if (y <= -1.25e+29) {
        		tmp = z * y;
        	} else if (y <= 2.3e+82) {
        		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 (y <= (-1.25d+29)) then
                tmp = z * y
            else if (y <= 2.3d+82) 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 (y <= -1.25e+29) {
        		tmp = z * y;
        	} else if (y <= 2.3e+82) {
        		tmp = a * t;
        	} else {
        		tmp = z * y;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t, a, b):
        	tmp = 0
        	if y <= -1.25e+29:
        		tmp = z * y
        	elif y <= 2.3e+82:
        		tmp = a * t
        	else:
        		tmp = z * y
        	return tmp
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if (y <= -1.25e+29)
        		tmp = Float64(z * y);
        	elseif (y <= 2.3e+82)
        		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 (y <= -1.25e+29)
        		tmp = z * y;
        	elseif (y <= 2.3e+82)
        		tmp = a * t;
        	else
        		tmp = z * y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.25e+29], N[(z * y), $MachinePrecision], If[LessEqual[y, 2.3e+82], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -1.25 \cdot 10^{+29}:\\
        \;\;\;\;z \cdot y\\
        
        \mathbf{elif}\;y \leq 2.3 \cdot 10^{+82}:\\
        \;\;\;\;a \cdot t\\
        
        \mathbf{else}:\\
        \;\;\;\;z \cdot y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -1.25e29 or 2.29999999999999988e82 < y

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

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

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

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

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

          if -1.25e29 < y < 2.29999999999999988e82

          1. Initial program 92.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-*.f6432.7

              \[\leadsto \color{blue}{t \cdot a} \]
          5. Applied rewrites32.7%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.25 \cdot 10^{+29}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+82}:\\ \;\;\;\;a \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
        5. Add Preprocessing

        Alternative 11: 55.5% accurate, 2.3× speedup?

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

          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 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-*.f6460.3

              \[\leadsto \color{blue}{z \cdot y} \]
          5. Applied rewrites60.3%

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

          if -1.09999999999999996e123 < y

          1. Initial program 92.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 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.f6458.8

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

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

        Alternative 12: 28.9% accurate, 5.0× speedup?

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

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

            \[\leadsto \color{blue}{t \cdot a} \]
        5. Applied rewrites27.1%

          \[\leadsto \color{blue}{t \cdot a} \]
        6. Final simplification27.1%

          \[\leadsto a \cdot t \]
        7. Add Preprocessing

        Developer Target 1: 97.1% 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 2024249 
        (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)))