Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.3% → 96.9%
Time: 7.5s
Alternatives: 13
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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.3% 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, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8999999999999999e189 or 1.35000000000000009e140 < z

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)}, z, x\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right), z, x\right) \]
      13. remove-double-negN/A

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

        \[\leadsto \mathsf{fma}\left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}, z, x\right) \]
      15. fp-cancel-sub-sign-invN/A

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

        \[\leadsto \mathsf{fma}\left(a \cdot b - \color{blue}{y \cdot -1}, z, x\right) \]
      17. fp-cancel-sub-sign-invN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right), z, x\right) \]
      21. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right), z, x\right) \]
      22. remove-double-negN/A

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

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

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

    if -1.8999999999999999e189 < z < 1.35000000000000009e140

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 65.5% accurate, 0.4× 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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+279}\right):\\ \;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\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 (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+279)))
     (* (fma b a y) z)
     (fma y z 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 <= -((double) INFINITY)) || !(t_1 <= 5e+279)) {
		tmp = fma(b, a, y) * z;
	} else {
		tmp = fma(y, z, 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 <= Float64(-Inf)) || !(t_1 <= 5e+279))
		tmp = Float64(fma(b, a, y) * z);
	else
		tmp = fma(y, z, 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+279]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], N[(y * z + x), $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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+279}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\

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


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

    1. Initial program 72.9%

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

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

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

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(y + a \cdot b\right)\right)\right)\right)\right)} \cdot z \]
      4. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(y + a \cdot b\right)}\right)\right) \cdot z \]
      5. distribute-lft-outN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot y\right)}\right)\right) \cdot z \]
      7. distribute-neg-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right)} \cdot z \]
      8. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right) \cdot z \]
      9. remove-double-negN/A

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

        \[\leadsto \left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}\right) \cdot z \]
      11. fp-cancel-sub-sign-invN/A

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

        \[\leadsto \left(a \cdot b - \color{blue}{y \cdot -1}\right) \cdot z \]
      13. fp-cancel-sub-sign-invN/A

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

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

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

        \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right)\right) \cdot z \]
      17. mul-1-negN/A

        \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right)\right) \cdot z \]
      18. remove-double-negN/A

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

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

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

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

    1. Initial program 99.9%

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

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
      4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
      12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 59.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{+224}:\\
\;\;\;\;\left(z \cdot b\right) \cdot a\\

\mathbf{elif}\;a \leq -7.5 \cdot 10^{+96}:\\
\;\;\;\;a \cdot t\\

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

\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.2e224

    1. Initial program 51.2%

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

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

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

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

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

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

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

      \[\leadsto \left(b \cdot z\right) \cdot a \]
    7. Step-by-step derivation
      1. Applied rewrites85.9%

        \[\leadsto \left(z \cdot b\right) \cdot a \]

      if -1.2e224 < a < -7.4999999999999996e96

      1. Initial program 90.2%

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

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

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

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

      if -7.4999999999999996e96 < a < 6.99999999999999963e152

      1. Initial program 96.5%

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

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

          \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
        3. fp-cancel-sign-sub-invN/A

          \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
        4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
        12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 6.99999999999999963e152 < a

      1. Initial program 79.8%

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

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

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

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

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(y + a \cdot b\right)\right)\right)\right)\right)} \cdot z \]
        4. mul-1-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(y + a \cdot b\right)}\right)\right) \cdot z \]
        5. distribute-lft-outN/A

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

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot y\right)}\right)\right) \cdot z \]
        7. distribute-neg-inN/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right)} \cdot z \]
        8. mul-1-negN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right) \cdot z \]
        9. remove-double-negN/A

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

          \[\leadsto \left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}\right) \cdot z \]
        11. fp-cancel-sub-sign-invN/A

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

          \[\leadsto \left(a \cdot b - \color{blue}{y \cdot -1}\right) \cdot z \]
        13. fp-cancel-sub-sign-invN/A

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

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

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

          \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right)\right) \cdot z \]
        17. mul-1-negN/A

          \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right)\right) \cdot z \]
        18. remove-double-negN/A

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

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

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

        \[\leadsto \left(a \cdot b\right) \cdot z \]
      7. Step-by-step derivation
        1. Applied rewrites54.9%

          \[\leadsto \left(b \cdot a\right) \cdot z \]
      8. Recombined 4 regimes into one program.
      9. Final simplification64.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.2 \cdot 10^{+224}:\\ \;\;\;\;\left(z \cdot b\right) \cdot a\\ \mathbf{elif}\;a \leq -7.5 \cdot 10^{+96}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 7 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z\\ \end{array} \]
      10. Add Preprocessing

      Alternative 4: 59.6% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(b \cdot a\right) \cdot z\\ \mathbf{if}\;a \leq -1.2 \cdot 10^{+224}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq -7.5 \cdot 10^{+96}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 7 \cdot 10^{+152}:\\ \;\;\;\;\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 (* (* b a) z)))
         (if (<= a -1.2e+224)
           t_1
           (if (<= a -7.5e+96) (* a t) (if (<= a 7e+152) (fma y z x) t_1)))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double t_1 = (b * a) * z;
      	double tmp;
      	if (a <= -1.2e+224) {
      		tmp = t_1;
      	} else if (a <= -7.5e+96) {
      		tmp = a * t;
      	} else if (a <= 7e+152) {
      		tmp = fma(y, z, x);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	t_1 = Float64(Float64(b * a) * z)
      	tmp = 0.0
      	if (a <= -1.2e+224)
      		tmp = t_1;
      	elseif (a <= -7.5e+96)
      		tmp = Float64(a * t);
      	elseif (a <= 7e+152)
      		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[(b * a), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[a, -1.2e+224], t$95$1, If[LessEqual[a, -7.5e+96], N[(a * t), $MachinePrecision], If[LessEqual[a, 7e+152], N[(y * z + x), $MachinePrecision], t$95$1]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(b \cdot a\right) \cdot z\\
      \mathbf{if}\;a \leq -1.2 \cdot 10^{+224}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;a \leq -7.5 \cdot 10^{+96}:\\
      \;\;\;\;a \cdot t\\
      
      \mathbf{elif}\;a \leq 7 \cdot 10^{+152}:\\
      \;\;\;\;\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 < -1.2e224 or 6.99999999999999963e152 < a

        1. Initial program 70.9%

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

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

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

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(y + a \cdot b\right)\right)\right)\right)\right)} \cdot z \]
          4. mul-1-negN/A

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(y + a \cdot b\right)}\right)\right) \cdot z \]
          5. distribute-lft-outN/A

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

            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot y\right)}\right)\right) \cdot z \]
          7. distribute-neg-inN/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right)} \cdot z \]
          8. mul-1-negN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right) \cdot z \]
          9. remove-double-negN/A

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

            \[\leadsto \left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}\right) \cdot z \]
          11. fp-cancel-sub-sign-invN/A

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

            \[\leadsto \left(a \cdot b - \color{blue}{y \cdot -1}\right) \cdot z \]
          13. fp-cancel-sub-sign-invN/A

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

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

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

            \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right)\right) \cdot z \]
          17. mul-1-negN/A

            \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right)\right) \cdot z \]
          18. remove-double-negN/A

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

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

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

          \[\leadsto \left(a \cdot b\right) \cdot z \]
        7. Step-by-step derivation
          1. Applied rewrites61.8%

            \[\leadsto \left(b \cdot a\right) \cdot z \]

          if -1.2e224 < a < -7.4999999999999996e96

          1. Initial program 90.2%

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

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

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

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

          if -7.4999999999999996e96 < a < 6.99999999999999963e152

          1. Initial program 96.5%

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

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

              \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
            3. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
            4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
            12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.2 \cdot 10^{+224}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z\\ \mathbf{elif}\;a \leq -7.5 \cdot 10^{+96}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 7 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot z\\ \end{array} \]
        10. Add Preprocessing

        Alternative 5: 86.4% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+47} \lor \neg \left(y \leq 1.95 \cdot 10^{-16}\right):\\ \;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= y -2.35e+47) (not (<= y 1.95e-16)))
           (fma z y (fma t a x))
           (fma (fma b z t) a x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((y <= -2.35e+47) || !(y <= 1.95e-16)) {
        		tmp = fma(z, y, fma(t, a, x));
        	} else {
        		tmp = fma(fma(b, z, t), a, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((y <= -2.35e+47) || !(y <= 1.95e-16))
        		tmp = fma(z, y, fma(t, a, x));
        	else
        		tmp = fma(fma(b, z, t), a, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.35e+47], N[Not[LessEqual[y, 1.95e-16]], $MachinePrecision]], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -2.35 \cdot 10^{+47} \lor \neg \left(y \leq 1.95 \cdot 10^{-16}\right):\\
        \;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -2.34999999999999982e47 or 1.94999999999999989e-16 < y

          1. Initial program 86.7%

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

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

              \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
            3. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
            4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
            12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -2.34999999999999982e47 < y < 1.94999999999999989e-16

          1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 86.5% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -14000000 \lor \neg \left(z \leq 9.2 \cdot 10^{+82}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= z -14000000.0) (not (<= z 9.2e+82)))
           (fma (fma b a y) z x)
           (fma (fma b z t) a x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((z <= -14000000.0) || !(z <= 9.2e+82)) {
        		tmp = fma(fma(b, a, y), z, x);
        	} else {
        		tmp = fma(fma(b, z, t), a, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((z <= -14000000.0) || !(z <= 9.2e+82))
        		tmp = fma(fma(b, a, y), z, x);
        	else
        		tmp = fma(fma(b, z, t), a, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -14000000.0], N[Not[LessEqual[z, 9.2e+82]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -14000000 \lor \neg \left(z \leq 9.2 \cdot 10^{+82}\right):\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -1.4e7 or 9.19999999999999953e82 < z

          1. Initial program 78.0%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)}, z, x\right) \]
            12. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right), z, x\right) \]
            13. remove-double-negN/A

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

              \[\leadsto \mathsf{fma}\left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}, z, x\right) \]
            15. fp-cancel-sub-sign-invN/A

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

              \[\leadsto \mathsf{fma}\left(a \cdot b - \color{blue}{y \cdot -1}, z, x\right) \]
            17. fp-cancel-sub-sign-invN/A

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

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

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

              \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right), z, x\right) \]
            21. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right), z, x\right) \]
            22. remove-double-negN/A

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

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

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

          if -1.4e7 < z < 9.19999999999999953e82

          1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 80.5% accurate, 1.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{+105} \lor \neg \left(t \leq 1.4 \cdot 10^{+21}\right):\\ \;\;\;\;\mathsf{fma}\left(z, y, t \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= t -5.8e+105) (not (<= t 1.4e+21)))
           (fma z y (* t a))
           (fma (fma b a y) z x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((t <= -5.8e+105) || !(t <= 1.4e+21)) {
        		tmp = fma(z, y, (t * a));
        	} else {
        		tmp = fma(fma(b, a, y), z, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((t <= -5.8e+105) || !(t <= 1.4e+21))
        		tmp = fma(z, y, Float64(t * a));
        	else
        		tmp = fma(fma(b, a, y), z, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -5.8e+105], N[Not[LessEqual[t, 1.4e+21]], $MachinePrecision]], N[(z * y + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;t \leq -5.8 \cdot 10^{+105} \lor \neg \left(t \leq 1.4 \cdot 10^{+21}\right):\\
        \;\;\;\;\mathsf{fma}\left(z, y, t \cdot a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -5.8000000000000002e105 or 1.4e21 < t

          1. Initial program 83.5%

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

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

              \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
            3. fp-cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
            4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
            12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -5.8000000000000002e105 < t < 1.4e21

            1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)}, z, x\right) \]
              12. mul-1-negN/A

                \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right), z, x\right) \]
              13. remove-double-negN/A

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

                \[\leadsto \mathsf{fma}\left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}, z, x\right) \]
              15. fp-cancel-sub-sign-invN/A

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

                \[\leadsto \mathsf{fma}\left(a \cdot b - \color{blue}{y \cdot -1}, z, x\right) \]
              17. fp-cancel-sub-sign-invN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right), z, x\right) \]
              21. mul-1-negN/A

                \[\leadsto \mathsf{fma}\left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right), z, x\right) \]
              22. remove-double-negN/A

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

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

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

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

          Alternative 8: 74.6% accurate, 1.2× speedup?

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

            1. Initial program 81.0%

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

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

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

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

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

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

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

            if -1.45e-19 < a < 1.22000000000000005e51

            1. Initial program 98.4%

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

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

                \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
              4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
              12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 9: 59.8% accurate, 1.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -4.5 \cdot 10^{+99} \lor \neg \left(a \leq 3.5 \cdot 10^{+152}\right):\\ \;\;\;\;\left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \end{array} \end{array} \]
          (FPCore (x y z t a b)
           :precision binary64
           (if (or (<= a -4.5e+99) (not (<= a 3.5e+152))) (* (* a z) b) (fma y z x)))
          double code(double x, double y, double z, double t, double a, double b) {
          	double tmp;
          	if ((a <= -4.5e+99) || !(a <= 3.5e+152)) {
          		tmp = (a * z) * b;
          	} else {
          		tmp = fma(y, z, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b)
          	tmp = 0.0
          	if ((a <= -4.5e+99) || !(a <= 3.5e+152))
          		tmp = Float64(Float64(a * z) * b);
          	else
          		tmp = fma(y, z, x);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -4.5e+99], N[Not[LessEqual[a, 3.5e+152]], $MachinePrecision]], N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision], N[(y * z + x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;a \leq -4.5 \cdot 10^{+99} \lor \neg \left(a \leq 3.5 \cdot 10^{+152}\right):\\
          \;\;\;\;\left(a \cdot z\right) \cdot b\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if a < -4.5e99 or 3.49999999999999981e152 < a

            1. Initial program 75.2%

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

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

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

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

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(y + a \cdot b\right)\right)\right)\right)\right)} \cdot z \]
              4. mul-1-negN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(y + a \cdot b\right)}\right)\right) \cdot z \]
              5. distribute-lft-outN/A

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

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + -1 \cdot y\right)}\right)\right) \cdot z \]
              7. distribute-neg-inN/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot \left(a \cdot b\right)\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right)} \cdot z \]
              8. mul-1-negN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)}\right)\right) + \left(\mathsf{neg}\left(-1 \cdot y\right)\right)\right) \cdot z \]
              9. remove-double-negN/A

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

                \[\leadsto \left(a \cdot b + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right) \cdot y}\right) \cdot z \]
              11. fp-cancel-sub-sign-invN/A

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

                \[\leadsto \left(a \cdot b - \color{blue}{y \cdot -1}\right) \cdot z \]
              13. fp-cancel-sub-sign-invN/A

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

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

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

                \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot y}\right)\right)\right) \cdot z \]
              17. mul-1-negN/A

                \[\leadsto \left(b \cdot a + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right)\right) \cdot z \]
              18. remove-double-negN/A

                \[\leadsto \left(b \cdot a + \color{blue}{y}\right) \cdot z \]
              19. lower-fma.f6461.2

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

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

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

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

              if -4.5e99 < a < 3.49999999999999981e152

              1. Initial program 96.5%

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

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

                  \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
                4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
                12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(y, z, x\right)} \]
            8. Recombined 2 regimes into one program.
            9. Final simplification61.0%

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

            Alternative 10: 95.7% accurate, 1.4× speedup?

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

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

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

                \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
              4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
              12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

            Alternative 11: 59.0% accurate, 1.6× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -6.5 \cdot 10^{+167} \lor \neg \left(t \leq 1.3 \cdot 10^{+109}\right):\\ \;\;\;\;a \cdot t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t a b)
             :precision binary64
             (if (or (<= t -6.5e+167) (not (<= t 1.3e+109))) (* a t) (fma y z x)))
            double code(double x, double y, double z, double t, double a, double b) {
            	double tmp;
            	if ((t <= -6.5e+167) || !(t <= 1.3e+109)) {
            		tmp = a * t;
            	} else {
            		tmp = fma(y, z, x);
            	}
            	return tmp;
            }
            
            function code(x, y, z, t, a, b)
            	tmp = 0.0
            	if ((t <= -6.5e+167) || !(t <= 1.3e+109))
            		tmp = Float64(a * t);
            	else
            		tmp = fma(y, z, x);
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -6.5e+167], N[Not[LessEqual[t, 1.3e+109]], $MachinePrecision]], N[(a * t), $MachinePrecision], N[(y * z + x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;t \leq -6.5 \cdot 10^{+167} \lor \neg \left(t \leq 1.3 \cdot 10^{+109}\right):\\
            \;\;\;\;a \cdot t\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if t < -6.5e167 or 1.2999999999999999e109 < t

              1. Initial program 82.6%

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

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

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

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

              if -6.5e167 < t < 1.2999999999999999e109

              1. Initial program 92.1%

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

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

                  \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
                4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
                12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 12: 38.1% accurate, 1.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+140} \lor \neg \left(y \leq 0.75\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
            (FPCore (x y z t a b)
             :precision binary64
             (if (or (<= y -1.8e+140) (not (<= y 0.75))) (* y z) (* a t)))
            double code(double x, double y, double z, double t, double a, double b) {
            	double tmp;
            	if ((y <= -1.8e+140) || !(y <= 0.75)) {
            		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 ((y <= (-1.8d+140)) .or. (.not. (y <= 0.75d0))) 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 ((y <= -1.8e+140) || !(y <= 0.75)) {
            		tmp = y * z;
            	} else {
            		tmp = a * t;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b):
            	tmp = 0
            	if (y <= -1.8e+140) or not (y <= 0.75):
            		tmp = y * z
            	else:
            		tmp = a * t
            	return tmp
            
            function code(x, y, z, t, a, b)
            	tmp = 0.0
            	if ((y <= -1.8e+140) || !(y <= 0.75))
            		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 ((y <= -1.8e+140) || ~((y <= 0.75)))
            		tmp = y * z;
            	else
            		tmp = a * t;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.8e+140], N[Not[LessEqual[y, 0.75]], $MachinePrecision]], N[(y * z), $MachinePrecision], N[(a * t), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -1.8 \cdot 10^{+140} \lor \neg \left(y \leq 0.75\right):\\
            \;\;\;\;y \cdot z\\
            
            \mathbf{else}:\\
            \;\;\;\;a \cdot t\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -1.8e140 or 0.75 < y

              1. Initial program 87.5%

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

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

                  \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
                4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
                12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{y \cdot z} \]
              9. Step-by-step derivation
                1. lower-*.f6453.3

                  \[\leadsto \color{blue}{y \cdot z} \]
              10. Applied rewrites53.3%

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

              if -1.8e140 < y < 0.75

              1. Initial program 90.8%

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+140} \lor \neg \left(y \leq 0.75\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]
            5. Add Preprocessing

            Alternative 13: 28.5% accurate, 5.0× 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 89.6%

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

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

                \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b} \]
              4. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{z \cdot y} + \left(\left(x + t \cdot a\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a \cdot z\right)\right)\right)\right) \cdot b\right) \]
              12. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{y \cdot z} \]
            9. Step-by-step derivation
              1. lower-*.f6426.3

                \[\leadsto \color{blue}{y \cdot z} \]
            10. Applied rewrites26.3%

              \[\leadsto \color{blue}{y \cdot z} \]
            11. Add Preprocessing

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

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

            Reproduce

            ?
            herbie shell --seed 2024358 
            (FPCore (x y z t a b)
              :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
              :precision binary64
            
              :alt
              (! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
            
              (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))