Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.4% → 97.4%
Time: 8.4s
Alternatives: 11
Speedup: 1.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 92.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: 97.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x + a \cdot \mathsf{fma}\left(b, z, t\right)\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)) < 4.99999999999999991e295

    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

    if 4.99999999999999991e295 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 66.0%

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

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

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

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      4. 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.0

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

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

Alternative 2: 83.4% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.7999999999999999e95

    1. Initial program 91.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.f6488.3

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

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

    if -3.7999999999999999e95 < x < 1.90000000000000006e-16

    1. Initial program 91.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 x around 0

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

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

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

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

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

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

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

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

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

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

    if 1.90000000000000006e-16 < x

    1. Initial program 90.9%

      \[\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)} \]
    5. Taylor expanded in z around 0

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

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

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

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

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

Alternative 3: 86.8% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+63} \lor \neg \left(y \leq 2.9 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.7999999999999999e63 or 2.90000000000000005e-46 < y

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

    if -5.7999999999999999e63 < y < 2.90000000000000005e-46

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 86.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{+63} \lor \neg \left(a \leq 2.1 \cdot 10^{+36}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.2000000000000001e63 or 2.10000000000000004e36 < a

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

    if -6.2000000000000001e63 < a < 2.10000000000000004e36

    1. Initial program 98.2%

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

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

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

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

Alternative 5: 82.4% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{+63} \lor \neg \left(a \leq 1.3 \cdot 10^{+58}\right):\\
\;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.2000000000000001e63 or 1.29999999999999994e58 < a

    1. Initial program 82.5%

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

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

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

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

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

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

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

    if -6.2000000000000001e63 < a < 1.29999999999999994e58

    1. Initial program 98.2%

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

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

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

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

Alternative 6: 73.8% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{+51} \lor \neg \left(a \leq 7.6 \cdot 10^{+54}\right):\\
\;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.69999999999999992e51 or 7.6000000000000005e54 < a

    1. Initial program 82.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 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.f6481.9

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

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

    if -1.69999999999999992e51 < a < 7.6000000000000005e54

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 96.0% accurate, 1.4× speedup?

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

\\
\mathsf{fma}\left(z, y, x + a \cdot \mathsf{fma}\left(b, z, t\right)\right)
\end{array}
Derivation
  1. Initial program 91.6%

    \[\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.f6495.8

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

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

Alternative 8: 58.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+105} \lor \neg \left(t \leq 1.75 \cdot 10^{+87}\right):\\
\;\;\;\;a \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.49999999999999991e105 or 1.74999999999999993e87 < t

    1. Initial program 86.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. lower-*.f6461.1

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

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

    if -3.49999999999999991e105 < t < 1.74999999999999993e87

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, a, \mathsf{fma}\left(\color{blue}{z \cdot b}, a, x\right)\right) \]
      5. lower-*.f6467.1

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

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

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

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

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

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

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

Alternative 9: 61.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1480000000:\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\

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

\mathbf{else}:\\
\;\;\;\;a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.48e9

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

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

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

    if -1.48e9 < a < 2.49999999999999993e58

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.49999999999999993e58 < a

    1. Initial program 75.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. lower-*.f6464.5

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

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

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

Alternative 10: 94.9% accurate, 1.6× speedup?

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

\\
\mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), \mathsf{fma}\left(z, y, x\right)\right)
\end{array}
Derivation
  1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 28.0% accurate, 5.0× speedup?

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

\\
a \cdot t
\end{array}
Derivation
  1. Initial program 91.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 inf

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

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

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

Developer Target 1: 97.4% 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 2024296 
(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)))