Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.4% → 98.1%
Time: 9.2s
Alternatives: 14
Speedup: 1.4×

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 14 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.4% 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: 98.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;a \leq 3.1 \cdot 10^{-108}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b + \left(t \cdot a + \left(y \cdot z + x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.00000000000000013e-138 or 3.10000000000000014e-108 < a

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000013e-138 < a < 3.10000000000000014e-108

    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. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternative 2: 95.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9e225 < z < 3.99999999999999986e219

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999986e219 < z

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

Alternative 3: 95.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9e225 < z < 3.99999999999999986e219

    1. Initial program 94.5%

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

        \[\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.f6498.6

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

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

    if 3.99999999999999986e219 < z

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

Alternative 4: 62.8% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\

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

\mathbf{elif}\;t \leq 0.000105:\\
\;\;\;\;\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 t < -1.6500000000000001e140 or 1.05e-4 < t

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

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

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

    if -1.6500000000000001e140 < t < -7.3999999999999994e-263

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -7.3999999999999994e-263 < t < 1.05e-4

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

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

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

    Alternative 5: 86.9% accurate, 1.2× speedup?

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

      1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.1500000000000001e88 < z < 2.35e-54

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

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

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

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

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

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

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

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

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

    Alternative 6: 86.5% accurate, 1.2× speedup?

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

      1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

      if -26500 < b < 9.80000000000000012e72

      1. Initial program 92.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.f6493.5

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

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

    Alternative 7: 82.4% 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 -4.6 \cdot 10^{+129}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 7.6 \cdot 10^{+87}:\\ \;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* (fma b z t) a)))
       (if (<= a -4.6e+129) t_1 (if (<= a 7.6e+87) (fma z y (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, z, t) * a;
    	double tmp;
    	if (a <= -4.6e+129) {
    		tmp = t_1;
    	} else if (a <= 7.6e+87) {
    		tmp = fma(z, y, fma(t, a, 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 <= -4.6e+129)
    		tmp = t_1;
    	elseif (a <= 7.6e+87)
    		tmp = fma(z, y, 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 * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -4.6e+129], t$95$1, If[LessEqual[a, 7.6e+87], N[(z * y + N[(t * a + x), $MachinePrecision]), $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 -4.6 \cdot 10^{+129}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 7.6 \cdot 10^{+87}:\\
    \;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -4.59999999999999981e129 or 7.60000000000000022e87 < a

      1. Initial program 80.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 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 -4.59999999999999981e129 < a < 7.60000000000000022e87

      1. Initial program 97.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 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.f6484.9

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

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

    Alternative 8: 73.6% 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 -820:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.2 \cdot 10^{+87}:\\ \;\;\;\;\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 -820.0) t_1 (if (<= a 1.2e+87) (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 <= -820.0) {
    		tmp = t_1;
    	} else if (a <= 1.2e+87) {
    		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 <= -820.0)
    		tmp = t_1;
    	elseif (a <= 1.2e+87)
    		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, -820.0], t$95$1, If[LessEqual[a, 1.2e+87], 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 -820:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 1.2 \cdot 10^{+87}:\\
    \;\;\;\;\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 < -820 or 1.19999999999999991e87 < a

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

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

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

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

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

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

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

      if -820 < a < 1.19999999999999991e87

      1. Initial program 97.8%

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

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

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

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

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

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

    Alternative 9: 75.0% 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 -8.5 \cdot 10^{+25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-33}:\\ \;\;\;\;\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 -8.5e+25) t_1 (if (<= z 1.32e-33) (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 <= -8.5e+25) {
    		tmp = t_1;
    	} else if (z <= 1.32e-33) {
    		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 <= -8.5e+25)
    		tmp = t_1;
    	elseif (z <= 1.32e-33)
    		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, -8.5e+25], t$95$1, If[LessEqual[z, 1.32e-33], 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 -8.5 \cdot 10^{+25}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 1.32 \cdot 10^{-33}:\\
    \;\;\;\;\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 < -8.5000000000000007e25 or 1.31999999999999993e-33 < z

      1. Initial program 85.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.f6477.5

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

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

      if -8.5000000000000007e25 < z < 1.31999999999999993e-33

      1. Initial program 97.5%

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

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

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

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

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

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

    Alternative 10: 95.7% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, y, \mathsf{fma}\left(b, z, t\right) \cdot a + x\right) \]
    6. Add Preprocessing

    Alternative 11: 62.7% accurate, 1.6× speedup?

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

      1. Initial program 90.7%

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

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

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

      if -1.1e58 < y < 4.50000000000000005e-32

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

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

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

    Alternative 12: 57.7% accurate, 1.6× speedup?

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

      1. Initial program 91.7%

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

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

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

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

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

      if -6.40000000000000032e97 < y < 2.2e77

      1. Initial program 90.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.f6461.3

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

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

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

    Alternative 13: 38.8% accurate, 1.7× speedup?

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

      1. Initial program 90.7%

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

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

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

      if -1.1e58 < y < 4.1999999999999998e-32

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+58}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-32}:\\ \;\;\;\;t \cdot a\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
    5. Add Preprocessing

    Alternative 14: 28.5% accurate, 5.0× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot a} \]
    6. 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 2024240 
    (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)))