Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.7% → 96.1%
Time: 9.9s
Alternatives: 11
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 92.7% accurate, 1.0× speedup?

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

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

Alternative 1: 96.1% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 98.5%

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

    if 5.0000000000000003e275 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 65.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. flip3-+N/A

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(\left(a \cdot z\right) \cdot b\right) \cdot \left(\left(a \cdot z\right) \cdot b\right) - \left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(a \cdot z\right) \cdot b\right)\right)}{{\left(\left(x + y \cdot z\right) + t \cdot a\right)}^{3} + {\left(\left(a \cdot z\right) \cdot b\right)}^{3}}}} \]
      5. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{{\left(\left(x + y \cdot z\right) + t \cdot a\right)}^{3} + {\left(\left(a \cdot z\right) \cdot b\right)}^{3}}{\left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(\left(a \cdot z\right) \cdot b\right) \cdot \left(\left(a \cdot z\right) \cdot b\right) - \left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(a \cdot z\right) \cdot b\right)\right)}}}} \]
    4. Applied rewrites93.4%

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

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

Alternative 2: 96.6% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 97.5%

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

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

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(\left(a \cdot z\right) \cdot b\right) \cdot \left(\left(a \cdot z\right) \cdot b\right) - \left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(a \cdot z\right) \cdot b\right)\right)}{{\left(\left(x + y \cdot z\right) + t \cdot a\right)}^{3} + {\left(\left(a \cdot z\right) \cdot b\right)}^{3}}}} \]
      5. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{{\left(\left(x + y \cdot z\right) + t \cdot a\right)}^{3} + {\left(\left(a \cdot z\right) \cdot b\right)}^{3}}{\left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\left(\left(a \cdot z\right) \cdot b\right) \cdot \left(\left(a \cdot z\right) \cdot b\right) - \left(\left(x + y \cdot z\right) + t \cdot a\right) \cdot \left(\left(a \cdot z\right) \cdot b\right)\right)}}}} \]
    4. Applied rewrites77.8%

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{t + b \cdot z}}{a}}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{t + b \cdot z}}{a}}} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{1}{t + b \cdot z}}}{a}} \]
      4. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{\frac{1}{\color{blue}{b \cdot z + t}}}{a}} \]
      5. lower-fma.f6472.2

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

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

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

Alternative 3: 96.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.5%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, z, t\right)}, a, x\right) \]
    5. Applied rewrites72.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. Final simplification95.8%

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

Alternative 4: 73.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\ \mathbf{if}\;a \leq -120000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2.6 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{elif}\;a \leq 2.8 \cdot 10^{+48}:\\ \;\;\;\;\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 z t) a)))
   (if (<= a -120000.0)
     t_1
     (if (<= a 2.6e-112) (fma z y x) (if (<= a 2.8e+48) (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 <= -120000.0) {
		tmp = t_1;
	} else if (a <= 2.6e-112) {
		tmp = fma(z, y, x);
	} else if (a <= 2.8e+48) {
		tmp = 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 <= -120000.0)
		tmp = t_1;
	elseif (a <= 2.6e-112)
		tmp = fma(z, y, x);
	elseif (a <= 2.8e+48)
		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 * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -120000.0], t$95$1, If[LessEqual[a, 2.6e-112], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 2.8e+48], N[(t * a + 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 -120000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 2.6 \cdot 10^{-112}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.2e5 or 2.80000000000000012e48 < a

    1. Initial program 81.1%

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

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

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

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

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

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

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

    if -1.2e5 < a < 2.59999999999999992e-112

    1. Initial program 100.0%

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

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

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

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

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

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

    if 2.59999999999999992e-112 < a < 2.80000000000000012e48

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 5: 86.7% accurate, 1.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.6499999999999998e-37 or 2.75e20 < y

    1. Initial program 88.7%

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

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

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

    if -3.6499999999999998e-37 < y < 2.75e20

    1. Initial program 92.6%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(b, z, t\right)}, a, x\right) \]
    5. Applied rewrites93.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. Add Preprocessing

Alternative 6: 82.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 -1.85 \cdot 10^{+174}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+53}:\\ \;\;\;\;\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 a y) z)))
   (if (<= z -1.85e+174) t_1 (if (<= z 1.45e+53) (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, a, y) * z;
	double tmp;
	if (z <= -1.85e+174) {
		tmp = t_1;
	} else if (z <= 1.45e+53) {
		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, a, y) * z)
	tmp = 0.0
	if (z <= -1.85e+174)
		tmp = t_1;
	elseif (z <= 1.45e+53)
		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), $MachinePrecision]}, If[LessEqual[z, -1.85e+174], t$95$1, If[LessEqual[z, 1.45e+53], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.45 \cdot 10^{+53}:\\
\;\;\;\;\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 z < -1.8500000000000001e174 or 1.4500000000000001e53 < z

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

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

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

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

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

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

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

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

    if -1.8500000000000001e174 < z < 1.4500000000000001e53

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

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

      \[\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: 74.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 -2.7 \cdot 10^{+71}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-55}:\\ \;\;\;\;\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 -2.7e+71) t_1 (if (<= z 1.7e-55) (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 <= -2.7e+71) {
		tmp = t_1;
	} else if (z <= 1.7e-55) {
		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 <= -2.7e+71)
		tmp = t_1;
	elseif (z <= 1.7e-55)
		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, -2.7e+71], t$95$1, If[LessEqual[z, 1.7e-55], 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 -2.7 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.7 \cdot 10^{-55}:\\
\;\;\;\;\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 < -2.69999999999999997e71 or 1.69999999999999986e-55 < z

    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 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.f6476.1

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

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

    if -2.69999999999999997e71 < z < 1.69999999999999986e-55

    1. Initial program 98.4%

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

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

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

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

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

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

Alternative 8: 63.5% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -150000:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+34}:\\
\;\;\;\;\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.5e5 or 1.5999999999999999e34 < y

    1. Initial program 89.4%

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

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

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

    if -1.5e5 < y < 1.5999999999999999e34

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

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

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

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

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

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

Alternative 9: 58.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+128}:\\
\;\;\;\;z \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;z \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.20000000000000008e128 or 1.64999999999999994e34 < y

    1. Initial program 89.5%

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

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

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

    if -6.20000000000000008e128 < y < 1.64999999999999994e34

    1. Initial program 91.4%

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

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

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

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

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

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

Alternative 10: 38.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.0056:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+34}:\\ \;\;\;\;a \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -0.0056) (* z y) (if (<= y 1.6e+34) (* a t) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -0.0056) {
		tmp = z * y;
	} else if (y <= 1.6e+34) {
		tmp = a * t;
	} else {
		tmp = z * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= (-0.0056d0)) then
        tmp = z * y
    else if (y <= 1.6d+34) then
        tmp = a * t
    else
        tmp = z * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -0.0056) {
		tmp = z * y;
	} else if (y <= 1.6e+34) {
		tmp = a * t;
	} else {
		tmp = z * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -0.0056:
		tmp = z * y
	elif y <= 1.6e+34:
		tmp = a * t
	else:
		tmp = z * y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -0.0056)
		tmp = Float64(z * y);
	elseif (y <= 1.6e+34)
		tmp = Float64(a * t);
	else
		tmp = Float64(z * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -0.0056)
		tmp = z * y;
	elseif (y <= 1.6e+34)
		tmp = a * t;
	else
		tmp = z * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -0.0056], N[(z * y), $MachinePrecision], If[LessEqual[y, 1.6e+34], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0056:\\
\;\;\;\;z \cdot y\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+34}:\\
\;\;\;\;a \cdot t\\

\mathbf{else}:\\
\;\;\;\;z \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.00559999999999999994 or 1.5999999999999999e34 < y

    1. Initial program 89.6%

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

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

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

    if -0.00559999999999999994 < y < 1.5999999999999999e34

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

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

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

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

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

Alternative 11: 27.3% 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 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 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-*.f6429.1

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

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

    \[\leadsto a \cdot t \]
  7. 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 2024257 
(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)))