Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.8% → 96.6%
Time: 7.4s
Alternatives: 11
Speedup: 0.5×

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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 96.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.9%

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

    if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 62.4% accurate, 0.9× speedup?

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

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

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

\mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\

\mathbf{elif}\;a \leq 1.06 \cdot 10^{+211}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -5.7999999999999999e188

    1. Initial program 60.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 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-*.f6460.0

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

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

    if -5.7999999999999999e188 < a < -1e-61 or 1.9000000000000001e26 < a < 1.0599999999999999e211

    1. Initial program 92.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in z around 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.f6465.9

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

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

    if -1e-61 < a < 1.9000000000000001e26

    1. Initial program 98.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Add Preprocessing
    3. Taylor expanded in 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.f6473.9

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

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

    if 1.0599999999999999e211 < a

    1. Initial program 71.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-*.f6458.0

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

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

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

    Alternative 3: 62.7% accurate, 0.9× speedup?

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

      1. Initial program 56.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 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-*.f6459.4

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

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

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

        if -3.5999999999999998e233 < a < -1e-61 or 1.9000000000000001e26 < a < 1.0599999999999999e211

        1. Initial program 90.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.f6464.5

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

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

        if -1e-61 < a < 1.9000000000000001e26

        1. Initial program 98.3%

          \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
        2. Add Preprocessing
        3. Taylor expanded in 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.f6473.9

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

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

        if 1.0599999999999999e211 < a

        1. Initial program 71.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-*.f6458.0

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.6 \cdot 10^{+233}:\\ \;\;\;\;b \cdot \left(a \cdot z\right)\\ \mathbf{elif}\;a \leq -1 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;a \leq 1.06 \cdot 10^{+211}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z\\ \end{array} \]
        9. Add Preprocessing

        Alternative 4: 63.3% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.6 \cdot 10^{+233}:\\ \;\;\;\;b \cdot \left(a \cdot z\right)\\ \mathbf{elif}\;a \leq -1 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\ \;\;\;\;\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.6e+233)
           (* b (* a z))
           (if (<= a -1e-61) (fma t a x) (if (<= a 1.9e+26) (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.6e+233) {
        		tmp = b * (a * z);
        	} else if (a <= -1e-61) {
        		tmp = fma(t, a, x);
        	} else if (a <= 1.9e+26) {
        		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.6e+233)
        		tmp = Float64(b * Float64(a * z));
        	elseif (a <= -1e-61)
        		tmp = fma(t, a, x);
        	elseif (a <= 1.9e+26)
        		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.6e+233], N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1e-61], N[(t * a + x), $MachinePrecision], If[LessEqual[a, 1.9e+26], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -3.6 \cdot 10^{+233}:\\
        \;\;\;\;b \cdot \left(a \cdot z\right)\\
        
        \mathbf{elif}\;a \leq -1 \cdot 10^{-61}:\\
        \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
        
        \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\
        \;\;\;\;\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.5999999999999998e233

          1. Initial program 56.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 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-*.f6459.4

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

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

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

            if -3.5999999999999998e233 < a < -1e-61 or 1.9000000000000001e26 < a

            1. Initial program 87.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.f6460.0

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

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

            if -1e-61 < a < 1.9000000000000001e26

            1. Initial program 98.3%

              \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
            2. Add Preprocessing
            3. Taylor expanded in 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.f6473.9

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3.6 \cdot 10^{+233}:\\ \;\;\;\;b \cdot \left(a \cdot z\right)\\ \mathbf{elif}\;a \leq -1 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \end{array} \]
          9. Add Preprocessing

          Alternative 5: 82.9% accurate, 1.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \mathbf{if}\;a \leq -1.16 \cdot 10^{-62}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 7 \cdot 10^{-133}:\\ \;\;\;\;\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 (fma b z t) a x)))
             (if (<= a -1.16e-62) t_1 (if (<= a 7e-133) (fma z y x) t_1))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double t_1 = fma(fma(b, z, t), a, x);
          	double tmp;
          	if (a <= -1.16e-62) {
          		tmp = t_1;
          	} else if (a <= 7e-133) {
          		tmp = fma(z, y, x);
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b)
          	t_1 = fma(fma(b, z, t), a, x)
          	tmp = 0.0
          	if (a <= -1.16e-62)
          		tmp = t_1;
          	elseif (a <= 7e-133)
          		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 + x), $MachinePrecision]}, If[LessEqual[a, -1.16e-62], t$95$1, If[LessEqual[a, 7e-133], N[(z * y + x), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
          \mathbf{if}\;a \leq -1.16 \cdot 10^{-62}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;a \leq 7 \cdot 10^{-133}:\\
          \;\;\;\;\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 < -1.1599999999999999e-62 or 7.00000000000000006e-133 < a

            1. Initial program 84.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 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.f6486.4

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

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

            if -1.1599999999999999e-62 < a < 7.00000000000000006e-133

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

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

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

          Alternative 6: 72.7% 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 -8.8 \cdot 10^{+46}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 9.5 \cdot 10^{-133}:\\ \;\;\;\;\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 -8.8e+46) t_1 (if (<= a 9.5e-133) (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 <= -8.8e+46) {
          		tmp = t_1;
          	} else if (a <= 9.5e-133) {
          		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 <= -8.8e+46)
          		tmp = t_1;
          	elseif (a <= 9.5e-133)
          		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, -8.8e+46], t$95$1, If[LessEqual[a, 9.5e-133], 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 -8.8 \cdot 10^{+46}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;a \leq 9.5 \cdot 10^{-133}:\\
          \;\;\;\;\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 < -8.8000000000000001e46 or 9.4999999999999992e-133 < a

            1. Initial program 83.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 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.f6474.2

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

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

            if -8.8000000000000001e46 < a < 9.4999999999999992e-133

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

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

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

          Alternative 7: 73.9% 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.9 \cdot 10^{-21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{+79}:\\ \;\;\;\;\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.9e-21) t_1 (if (<= z 9.8e+79) (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.9e-21) {
          		tmp = t_1;
          	} else if (z <= 9.8e+79) {
          		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.9e-21)
          		tmp = t_1;
          	elseif (z <= 9.8e+79)
          		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.9e-21], t$95$1, If[LessEqual[z, 9.8e+79], 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.9 \cdot 10^{-21}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;z \leq 9.8 \cdot 10^{+79}:\\
          \;\;\;\;\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.8999999999999999e-21 or 9.7999999999999997e79 < z

            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 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.f6473.8

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

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

            if -1.8999999999999999e-21 < z < 9.7999999999999997e79

            1. Initial program 98.4%

              \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
            2. Add Preprocessing
            3. Taylor expanded in 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.f6472.0

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

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

          Alternative 8: 63.7% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\ \;\;\;\;\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 -1e-61) (fma t a x) (if (<= a 1.9e+26) (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 <= -1e-61) {
          		tmp = fma(t, a, x);
          	} else if (a <= 1.9e+26) {
          		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 <= -1e-61)
          		tmp = fma(t, a, x);
          	elseif (a <= 1.9e+26)
          		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, -1e-61], N[(t * a + x), $MachinePrecision], If[LessEqual[a, 1.9e+26], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;a \leq -1 \cdot 10^{-61}:\\
          \;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
          
          \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\
          \;\;\;\;\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 a < -1e-61 or 1.9000000000000001e26 < a

            1. Initial program 81.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 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.f6456.1

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

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

            if -1e-61 < a < 1.9000000000000001e26

            1. Initial program 98.3%

              \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
            2. Add Preprocessing
            3. Taylor expanded in 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.f6473.9

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

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

          Alternative 9: 58.5% accurate, 1.6× speedup?

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

            1. Initial program 74.2%

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

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

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

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

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

            if -4.50000000000000001e198 < z < 5.1999999999999999e98

            1. Initial program 95.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.f6464.3

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

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

          Alternative 10: 39.4% accurate, 1.7× speedup?

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

            1. Initial program 81.9%

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

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

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

                \[\leadsto \color{blue}{t \cdot a} \]
            5. Applied rewrites39.8%

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

            if -1e-61 < a < 1.9000000000000001e26

            1. Initial program 98.3%

              \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
            2. Add Preprocessing
            3. Taylor expanded in 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-*.f6442.9

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{-61}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+26}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]
          5. Add Preprocessing

          Alternative 11: 27.8% 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 89.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-*.f6428.8

              \[\leadsto \color{blue}{t \cdot a} \]
          5. Applied rewrites28.8%

            \[\leadsto \color{blue}{t \cdot a} \]
          6. Final simplification28.8%

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

          Developer Target 1: 97.2% 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 2024266 
          (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)))