Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.7% → 97.6%
Time: 10.1s
Alternatives: 10
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 10 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: 97.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(\frac{z}{t}, \mathsf{fma}\left(b, a, y\right), a\right), t, 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 (/ z t) (fma b a y) a) t 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((z / t), fma(b, a, y), a), t, 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(Float64(z / t), fma(b, a, y), a), t, 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[(N[(z / t), $MachinePrecision] * N[(b * a + y), $MachinePrecision] + a), $MachinePrecision] * t + 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(\frac{z}{t}, \mathsf{fma}\left(b, a, y\right), a\right), t, 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 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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(\frac{z}{t}, \mathsf{fma}\left(b, a, y\right), a\right), t, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 92.6% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.45000000000000002e-105 or 4.20000000000000012e-56 < t

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.45000000000000002e-105 < t < 4.20000000000000012e-56

    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 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.f6493.9

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

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

Alternative 3: 73.6% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq 7000000000000:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(z, y, a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.1999999999999998e42 or 5.6e104 < z

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

    if -5.1999999999999998e42 < z < 7e12

    1. Initial program 99.2%

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

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

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

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

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

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

    if 7e12 < z < 5.6e104

    1. Initial program 96.2%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, y, a \cdot t\right) \]
    7. Step-by-step derivation
      1. Applied rewrites81.0%

        \[\leadsto \mathsf{fma}\left(z, y, t \cdot a\right) \]
    8. Recombined 3 regimes into one program.
    9. Final simplification79.0%

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

    Alternative 4: 87.0% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{if}\;z \leq -75:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (fma (fma b a y) z x)))
       (if (<= z -75.0) t_1 (if (<= z 5.6e+104) (fma z y (fma t a x)) t_1))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = fma(fma(b, a, y), z, x);
    	double tmp;
    	if (z <= -75.0) {
    		tmp = t_1;
    	} else if (z <= 5.6e+104) {
    		tmp = fma(z, y, fma(t, a, x));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	t_1 = fma(fma(b, a, y), z, x)
    	tmp = 0.0
    	if (z <= -75.0)
    		tmp = t_1;
    	elseif (z <= 5.6e+104)
    		tmp = fma(z, y, fma(t, a, x));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -75.0], t$95$1, If[LessEqual[z, 5.6e+104], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
    \mathbf{if}\;z \leq -75:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 5.6 \cdot 10^{+104}:\\
    \;\;\;\;\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 < -75 or 5.6e104 < z

      1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

      if -75 < z < 5.6e104

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

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

        \[\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 5: 71.9% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+42}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+131}:\\ \;\;\;\;\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 -5.2e+42) t_1 (if (<= z 1.25e+131) (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 <= -5.2e+42) {
    		tmp = t_1;
    	} else if (z <= 1.25e+131) {
    		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 <= -5.2e+42)
    		tmp = t_1;
    	elseif (z <= 1.25e+131)
    		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, -5.2e+42], t$95$1, If[LessEqual[z, 1.25e+131], 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 -5.2 \cdot 10^{+42}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 1.25 \cdot 10^{+131}:\\
    \;\;\;\;\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 < -5.1999999999999998e42 or 1.24999999999999999e131 < z

      1. Initial program 80.1%

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

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

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

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

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

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

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

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

      if -5.1999999999999998e42 < z < 1.24999999999999999e131

      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. Taylor expanded in z around 0

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

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

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

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

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

    Alternative 6: 62.2% accurate, 1.6× speedup?

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

      1. Initial program 89.3%

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

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

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

      if -1.45000000000000002e-105 < t < 9.0000000000000001e34

      1. Initial program 93.6%

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

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

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

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

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

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

    Alternative 7: 57.2% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+75}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+193}:\\ \;\;\;\;\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 -1.15e+75) (* z y) (if (<= y 5.8e+193) (fma t a x) (* z y))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double tmp;
    	if (y <= -1.15e+75) {
    		tmp = z * y;
    	} else if (y <= 5.8e+193) {
    		tmp = fma(t, a, x);
    	} else {
    		tmp = z * y;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	tmp = 0.0
    	if (y <= -1.15e+75)
    		tmp = Float64(z * y);
    	elseif (y <= 5.8e+193)
    		tmp = fma(t, a, x);
    	else
    		tmp = Float64(z * y);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.15e+75], N[(z * y), $MachinePrecision], If[LessEqual[y, 5.8e+193], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -1.15 \cdot 10^{+75}:\\
    \;\;\;\;z \cdot y\\
    
    \mathbf{elif}\;y \leq 5.8 \cdot 10^{+193}:\\
    \;\;\;\;\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 < -1.1499999999999999e75 or 5.80000000000000026e193 < y

      1. Initial program 88.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-*.f6455.8

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

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

      if -1.1499999999999999e75 < y < 5.80000000000000026e193

      1. Initial program 92.1%

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

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

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

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

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

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

    Alternative 8: 79.8% accurate, 1.6× speedup?

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

      1. Initial program 81.8%

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

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

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

      if -3.49999999999999999e56 < z

      1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 89.3%

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

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

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

      if -1.4e-105 < t < 9.0000000000000001e34

      1. Initial program 93.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-*.f6435.1

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

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

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

    Alternative 10: 28.6% 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.1%

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

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

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

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

      \[\leadsto \color{blue}{t \cdot a} \]
    6. Final simplification32.5%

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

    Developer Target 1: 97.2% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{if}\;z < -11820553527347888000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
       (if (< z -11820553527347888000.0)
         t_1
         (if (< z 4.7589743188364287e-122)
           (+ (* (+ (* b z) t) a) (+ (* z y) x))
           t_1))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
    	double tmp;
    	if (z < -11820553527347888000.0) {
    		tmp = t_1;
    	} else if (z < 4.7589743188364287e-122) {
    		tmp = (((b * z) + t) * a) + ((z * y) + x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t, a, b)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8) :: t_1
        real(8) :: tmp
        t_1 = (z * ((b * a) + y)) + (x + (t * a))
        if (z < (-11820553527347888000.0d0)) then
            tmp = t_1
        else if (z < 4.7589743188364287d-122) then
            tmp = (((b * z) + t) * a) + ((z * y) + x)
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
    	double tmp;
    	if (z < -11820553527347888000.0) {
    		tmp = t_1;
    	} else if (z < 4.7589743188364287e-122) {
    		tmp = (((b * z) + t) * a) + ((z * y) + x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = (z * ((b * a) + y)) + (x + (t * a))
    	tmp = 0
    	if z < -11820553527347888000.0:
    		tmp = t_1
    	elif z < 4.7589743188364287e-122:
    		tmp = (((b * z) + t) * a) + ((z * y) + x)
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a)))
    	tmp = 0.0
    	if (z < -11820553527347888000.0)
    		tmp = t_1;
    	elseif (z < 4.7589743188364287e-122)
    		tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = (z * ((b * a) + y)) + (x + (t * a));
    	tmp = 0.0;
    	if (z < -11820553527347888000.0)
    		tmp = t_1;
    	elseif (z < 4.7589743188364287e-122)
    		tmp = (((b * z) + t) * a) + ((z * y) + x);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
    \mathbf{if}\;z < -11820553527347888000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
    \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    

    Reproduce

    ?
    herbie shell --seed 2024273 
    (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)))