Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.1% → 96.9%
Time: 3.9s
Alternatives: 11
Speedup: 1.3×

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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
    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}

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.1% 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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
    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.9% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, 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)) < 3.99999999999999963e215

    1. Initial program 92.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]

    if 3.99999999999999963e215 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.8% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.9% accurate, 1.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.5000000000000001e90 or 29500 < a

    1. Initial program 92.1%

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, a \cdot \left(b \cdot z\right)\right) \]
      4. lower-*.f6474.2

        \[\leadsto x + \mathsf{fma}\left(a, t, a \cdot \left(b \cdot z\right)\right) \]
    4. Applied rewrites74.2%

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \left(t + b \cdot z\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(t + b \cdot z\right) \cdot a + x \]
      10. lower-fma.f6475.0

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z \cdot b + t, a, x\right) \]
      15. lower-fma.f6475.0

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right) \]
    6. Applied rewrites75.0%

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

    if -6.5000000000000001e90 < a < 29500

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, \color{blue}{t}, \mathsf{fma}\left(z, y, x\right)\right) \]
    5. Step-by-step derivation
      1. Applied rewrites77.3%

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

    Alternative 4: 82.5% accurate, 1.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right)\\ \mathbf{if}\;a \leq -1.5 \cdot 10^{-29}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{-52}:\\ \;\;\;\;\mathsf{fma}\left(y, 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 b t) a x)))
       (if (<= a -1.5e-29) t_1 (if (<= a 1.9e-52) (fma 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, b, t), a, x);
    	double tmp;
    	if (a <= -1.5e-29) {
    		tmp = t_1;
    	} else if (a <= 1.9e-52) {
    		tmp = fma(y, z, x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	t_1 = fma(fma(z, b, t), a, x)
    	tmp = 0.0
    	if (a <= -1.5e-29)
    		tmp = t_1;
    	elseif (a <= 1.9e-52)
    		tmp = fma(y, z, x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * b + t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[a, -1.5e-29], t$95$1, If[LessEqual[a, 1.9e-52], N[(y * z + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right)\\
    \mathbf{if}\;a \leq -1.5 \cdot 10^{-29}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 1.9 \cdot 10^{-52}:\\
    \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -1.5000000000000001e-29 or 1.9000000000000002e-52 < a

      1. Initial program 92.1%

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

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

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

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

          \[\leadsto x + \mathsf{fma}\left(a, t, a \cdot \left(b \cdot z\right)\right) \]
        4. lower-*.f6474.2

          \[\leadsto x + \mathsf{fma}\left(a, t, a \cdot \left(b \cdot z\right)\right) \]
      4. Applied rewrites74.2%

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

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

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

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

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

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

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

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

          \[\leadsto a \cdot \left(t + b \cdot z\right) + x \]
        9. *-commutativeN/A

          \[\leadsto \left(t + b \cdot z\right) \cdot a + x \]
        10. lower-fma.f6475.0

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

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

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

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

          \[\leadsto \mathsf{fma}\left(z \cdot b + t, a, x\right) \]
        15. lower-fma.f6475.0

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right) \]
      6. Applied rewrites75.0%

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

      if -1.5000000000000001e-29 < a < 1.9000000000000002e-52

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + y \cdot \color{blue}{z} \]
      8. Applied rewrites51.6%

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

          \[\leadsto \color{blue}{x} + y \cdot z \]
        2. lift-fma.f64N/A

          \[\leadsto x + y \cdot z \]
        3. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        4. associate-+l+N/A

          \[\leadsto \color{blue}{x} + y \cdot z \]
        5. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        6. *-commutativeN/A

          \[\leadsto x + y \cdot z \]
        7. lift-fma.f6451.6

          \[\leadsto x + y \cdot z \]
        8. distribute-lft-in51.6

          \[\leadsto x + y \cdot z \]
        9. associate-*l*51.6

          \[\leadsto x + y \cdot z \]
        10. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        11. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        12. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        13. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        14. associate-+r+N/A

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

          \[\leadsto x + y \cdot z \]
        16. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        17. lift-*.f6451.6

          \[\leadsto x + y \cdot z \]
        18. +-commutative51.6

          \[\leadsto \color{blue}{x} + y \cdot z \]
        19. lift-+.f64N/A

          \[\leadsto x + \color{blue}{y \cdot z} \]
        20. lift-*.f64N/A

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

          \[\leadsto x + z \cdot \color{blue}{y} \]
      10. Applied rewrites51.6%

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

    Alternative 5: 74.2% accurate, 1.0× speedup?

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

      1. Initial program 92.1%

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

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

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

          \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) \]
        3. lower-*.f6451.6

          \[\leadsto a \cdot \left(t + b \cdot \color{blue}{z}\right) \]
      4. Applied rewrites51.6%

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

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

          \[\leadsto \left(t + b \cdot z\right) \cdot \color{blue}{a} \]
        3. lower-*.f6451.6

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

          \[\leadsto \left(t + b \cdot z\right) \cdot a \]
        5. +-commutativeN/A

          \[\leadsto \left(b \cdot z + t\right) \cdot a \]
        6. lift-*.f64N/A

          \[\leadsto \left(b \cdot z + t\right) \cdot a \]
        7. *-commutativeN/A

          \[\leadsto \left(z \cdot b + t\right) \cdot a \]
        8. lower-fma.f6451.6

          \[\leadsto \mathsf{fma}\left(z, b, t\right) \cdot a \]
      6. Applied rewrites51.6%

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

      if -1.56e21 < a < 4.6000000000000001e-48

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + y \cdot \color{blue}{z} \]
      8. Applied rewrites51.6%

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

          \[\leadsto \color{blue}{x} + y \cdot z \]
        2. lift-fma.f64N/A

          \[\leadsto x + y \cdot z \]
        3. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        4. associate-+l+N/A

          \[\leadsto \color{blue}{x} + y \cdot z \]
        5. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        6. *-commutativeN/A

          \[\leadsto x + y \cdot z \]
        7. lift-fma.f6451.6

          \[\leadsto x + y \cdot z \]
        8. distribute-lft-in51.6

          \[\leadsto x + y \cdot z \]
        9. associate-*l*51.6

          \[\leadsto x + y \cdot z \]
        10. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        11. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        12. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        13. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        14. associate-+r+N/A

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

          \[\leadsto x + y \cdot z \]
        16. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        17. lift-*.f6451.6

          \[\leadsto x + y \cdot z \]
        18. +-commutative51.6

          \[\leadsto \color{blue}{x} + y \cdot z \]
        19. lift-+.f64N/A

          \[\leadsto x + \color{blue}{y \cdot z} \]
        20. lift-*.f64N/A

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

          \[\leadsto x + z \cdot \color{blue}{y} \]
      10. Applied rewrites51.6%

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

      if 4.6000000000000001e-48 < a < 7.6000000000000004e83

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \color{blue}{a \cdot t} \]
        2. lower-*.f6452.4

          \[\leadsto x + a \cdot \color{blue}{t} \]
      6. Applied rewrites52.4%

        \[\leadsto \color{blue}{x + a \cdot t} \]
    3. Recombined 3 regimes into one program.
    4. Add Preprocessing

    Alternative 6: 73.9% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 0.004:\\ \;\;\;\;x + a \cdot t\\ \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.4e-5) t_1 (if (<= z 0.004) (+ x (* 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 <= -2.4e-5) {
    		tmp = t_1;
    	} else if (z <= 0.004) {
    		tmp = x + (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 <= -2.4e-5)
    		tmp = t_1;
    	elseif (z <= 0.004)
    		tmp = Float64(x + 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, -2.4e-5], t$95$1, If[LessEqual[z, 0.004], N[(x + 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 -2.4 \cdot 10^{-5}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 0.004:\\
    \;\;\;\;x + a \cdot t\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -2.4000000000000001e-5 or 0.0040000000000000001 < z

      1. Initial program 92.1%

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

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

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

          \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
        3. lower-*.f6450.7

          \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
      4. Applied rewrites50.7%

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

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

          \[\leadsto \left(y + a \cdot b\right) \cdot \color{blue}{z} \]
        3. lower-*.f6450.7

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

          \[\leadsto \left(y + a \cdot b\right) \cdot z \]
        5. +-commutativeN/A

          \[\leadsto \left(a \cdot b + y\right) \cdot z \]
        6. lift-*.f64N/A

          \[\leadsto \left(a \cdot b + y\right) \cdot z \]
        7. *-commutativeN/A

          \[\leadsto \left(b \cdot a + y\right) \cdot z \]
        8. lower-fma.f6450.7

          \[\leadsto \mathsf{fma}\left(b, a, y\right) \cdot z \]
      6. Applied rewrites50.7%

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

      if -2.4000000000000001e-5 < z < 0.0040000000000000001

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \color{blue}{a \cdot t} \]
        2. lower-*.f6452.4

          \[\leadsto x + a \cdot \color{blue}{t} \]
      6. Applied rewrites52.4%

        \[\leadsto \color{blue}{x + a \cdot t} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 7: 63.5% accurate, 1.2× speedup?

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

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \color{blue}{a \cdot t} \]
        2. lower-*.f6452.4

          \[\leadsto x + a \cdot \color{blue}{t} \]
      6. Applied rewrites52.4%

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

      if -5.9000000000000001e125 < a < -6.5000000000000001e90

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

          \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
        3. lower-*.f6450.4

          \[\leadsto x + a \cdot \left(b \cdot z\right) \]
      7. Applied rewrites50.4%

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

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

          \[\leadsto a \cdot \left(b \cdot z\right) + x \]
        3. lift-*.f64N/A

          \[\leadsto a \cdot \left(b \cdot z\right) + x \]
        4. *-commutativeN/A

          \[\leadsto \left(b \cdot z\right) \cdot a + x \]
        5. lower-fma.f6450.4

          \[\leadsto \mathsf{fma}\left(b \cdot z, a, x\right) \]
      9. Applied rewrites50.4%

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

      if -6.5000000000000001e90 < a < 4.6000000000000001e-48

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + y \cdot \color{blue}{z} \]
      8. Applied rewrites51.6%

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

          \[\leadsto \color{blue}{x} + y \cdot z \]
        2. lift-fma.f64N/A

          \[\leadsto x + y \cdot z \]
        3. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        4. associate-+l+N/A

          \[\leadsto \color{blue}{x} + y \cdot z \]
        5. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        6. *-commutativeN/A

          \[\leadsto x + y \cdot z \]
        7. lift-fma.f6451.6

          \[\leadsto x + y \cdot z \]
        8. distribute-lft-in51.6

          \[\leadsto x + y \cdot z \]
        9. associate-*l*51.6

          \[\leadsto x + y \cdot z \]
        10. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        11. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        12. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        13. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        14. associate-+r+N/A

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

          \[\leadsto x + y \cdot z \]
        16. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        17. lift-*.f6451.6

          \[\leadsto x + y \cdot z \]
        18. +-commutative51.6

          \[\leadsto \color{blue}{x} + y \cdot z \]
        19. lift-+.f64N/A

          \[\leadsto x + \color{blue}{y \cdot z} \]
        20. lift-*.f64N/A

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

          \[\leadsto x + z \cdot \color{blue}{y} \]
      10. Applied rewrites51.6%

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

    Alternative 8: 62.9% accurate, 1.5× speedup?

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

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \color{blue}{a \cdot t} \]
        2. lower-*.f6452.4

          \[\leadsto x + a \cdot \color{blue}{t} \]
      6. Applied rewrites52.4%

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

      if -1.65e21 < a < 4.6000000000000001e-48

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + y \cdot \color{blue}{z} \]
      8. Applied rewrites51.6%

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

          \[\leadsto \color{blue}{x} + y \cdot z \]
        2. lift-fma.f64N/A

          \[\leadsto x + y \cdot z \]
        3. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        4. associate-+l+N/A

          \[\leadsto \color{blue}{x} + y \cdot z \]
        5. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        6. *-commutativeN/A

          \[\leadsto x + y \cdot z \]
        7. lift-fma.f6451.6

          \[\leadsto x + y \cdot z \]
        8. distribute-lft-in51.6

          \[\leadsto x + y \cdot z \]
        9. associate-*l*51.6

          \[\leadsto x + y \cdot z \]
        10. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        11. *-commutative51.6

          \[\leadsto x + y \cdot z \]
        12. lift-*.f64N/A

          \[\leadsto x + y \cdot z \]
        13. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        14. associate-+r+N/A

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

          \[\leadsto x + y \cdot z \]
        16. lift-+.f64N/A

          \[\leadsto x + y \cdot z \]
        17. lift-*.f6451.6

          \[\leadsto x + y \cdot z \]
        18. +-commutative51.6

          \[\leadsto \color{blue}{x} + y \cdot z \]
        19. lift-+.f64N/A

          \[\leadsto x + \color{blue}{y \cdot z} \]
        20. lift-*.f64N/A

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

          \[\leadsto x + z \cdot \color{blue}{y} \]
      10. Applied rewrites51.6%

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

    Alternative 9: 57.0% accurate, 1.6× speedup?

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

      1. Initial program 92.1%

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

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

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

          \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) \]
        3. lower-*.f6451.6

          \[\leadsto a \cdot \left(t + b \cdot \color{blue}{z}\right) \]
      4. Applied rewrites51.6%

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

        \[\leadsto a \cdot t \]
      6. Step-by-step derivation
        1. Applied rewrites28.7%

          \[\leadsto a \cdot t \]

        if -7.4999999999999996e-15 < t < 2.4000000000000002e122

        1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x + y \cdot \color{blue}{z} \]
        8. Applied rewrites51.6%

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

            \[\leadsto \color{blue}{x} + y \cdot z \]
          2. lift-fma.f64N/A

            \[\leadsto x + y \cdot z \]
          3. lift-*.f64N/A

            \[\leadsto x + y \cdot z \]
          4. associate-+l+N/A

            \[\leadsto \color{blue}{x} + y \cdot z \]
          5. lift-*.f64N/A

            \[\leadsto x + y \cdot z \]
          6. *-commutativeN/A

            \[\leadsto x + y \cdot z \]
          7. lift-fma.f6451.6

            \[\leadsto x + y \cdot z \]
          8. distribute-lft-in51.6

            \[\leadsto x + y \cdot z \]
          9. associate-*l*51.6

            \[\leadsto x + y \cdot z \]
          10. *-commutative51.6

            \[\leadsto x + y \cdot z \]
          11. *-commutative51.6

            \[\leadsto x + y \cdot z \]
          12. lift-*.f64N/A

            \[\leadsto x + y \cdot z \]
          13. lift-+.f64N/A

            \[\leadsto x + y \cdot z \]
          14. associate-+r+N/A

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

            \[\leadsto x + y \cdot z \]
          16. lift-+.f64N/A

            \[\leadsto x + y \cdot z \]
          17. lift-*.f6451.6

            \[\leadsto x + y \cdot z \]
          18. +-commutative51.6

            \[\leadsto \color{blue}{x} + y \cdot z \]
          19. lift-+.f64N/A

            \[\leadsto x + \color{blue}{y \cdot z} \]
          20. lift-*.f64N/A

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

            \[\leadsto x + z \cdot \color{blue}{y} \]
        10. Applied rewrites51.6%

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

      Alternative 10: 39.7% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.9 \cdot 10^{+20}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{-43}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
      (FPCore (x y z t a b)
       :precision binary64
       (if (<= a -3.9e+20) (* a t) (if (<= a 5.7e-43) (* y z) (* a t))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double tmp;
      	if (a <= -3.9e+20) {
      		tmp = a * t;
      	} else if (a <= 5.7e-43) {
      		tmp = y * z;
      	} else {
      		tmp = a * t;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y, z, t, a, b)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8), intent (in) :: t
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: tmp
          if (a <= (-3.9d+20)) then
              tmp = a * t
          else if (a <= 5.7d-43) then
              tmp = y * z
          else
              tmp = a * t
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z, double t, double a, double b) {
      	double tmp;
      	if (a <= -3.9e+20) {
      		tmp = a * t;
      	} else if (a <= 5.7e-43) {
      		tmp = y * z;
      	} else {
      		tmp = a * t;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t, a, b):
      	tmp = 0
      	if a <= -3.9e+20:
      		tmp = a * t
      	elif a <= 5.7e-43:
      		tmp = y * z
      	else:
      		tmp = a * t
      	return tmp
      
      function code(x, y, z, t, a, b)
      	tmp = 0.0
      	if (a <= -3.9e+20)
      		tmp = Float64(a * t);
      	elseif (a <= 5.7e-43)
      		tmp = Float64(y * z);
      	else
      		tmp = Float64(a * t);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t, a, b)
      	tmp = 0.0;
      	if (a <= -3.9e+20)
      		tmp = a * t;
      	elseif (a <= 5.7e-43)
      		tmp = y * z;
      	else
      		tmp = a * t;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.9e+20], N[(a * t), $MachinePrecision], If[LessEqual[a, 5.7e-43], N[(y * z), $MachinePrecision], N[(a * t), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq -3.9 \cdot 10^{+20}:\\
      \;\;\;\;a \cdot t\\
      
      \mathbf{elif}\;a \leq 5.7 \cdot 10^{-43}:\\
      \;\;\;\;y \cdot z\\
      
      \mathbf{else}:\\
      \;\;\;\;a \cdot t\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < -3.9e20 or 5.6999999999999999e-43 < a

        1. Initial program 92.1%

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

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

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

            \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) \]
          3. lower-*.f6451.6

            \[\leadsto a \cdot \left(t + b \cdot \color{blue}{z}\right) \]
        4. Applied rewrites51.6%

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

          \[\leadsto a \cdot t \]
        6. Step-by-step derivation
          1. Applied rewrites28.7%

            \[\leadsto a \cdot t \]

          if -3.9e20 < a < 5.6999999999999999e-43

          1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{y \cdot z} \]
          7. Step-by-step derivation
            1. lower-*.f6427.8

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

            \[\leadsto \color{blue}{y \cdot z} \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 11: 27.8% accurate, 5.3× speedup?

        \[\begin{array}{l} \\ y \cdot z \end{array} \]
        (FPCore (x y z t a b) :precision binary64 (* y z))
        double code(double x, double y, double z, double t, double a, double b) {
        	return y * z;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z, t, a, b)
        use fmin_fmax_functions
            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 = y * z
        end function
        
        public static double code(double x, double y, double z, double t, double a, double b) {
        	return y * z;
        }
        
        def code(x, y, z, t, a, b):
        	return y * z
        
        function code(x, y, z, t, a, b)
        	return Float64(y * z)
        end
        
        function tmp = code(x, y, z, t, a, b)
        	tmp = y * z;
        end
        
        code[x_, y_, z_, t_, a_, b_] := N[(y * z), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        y \cdot z
        \end{array}
        
        Derivation
        1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{y \cdot z} \]
        7. Step-by-step derivation
          1. lower-*.f6427.8

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

          \[\leadsto \color{blue}{y \cdot z} \]
        9. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025150 
        (FPCore (x y z t a b)
          :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
          :precision binary64
          (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))