Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.3% → 96.4%
Time: 3.1s
Alternatives: 12
Speedup: 1.1×

Specification

?
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
(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]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b

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 12 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?

\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
(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]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b

Alternative 1: 96.4% accurate, 1.1× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq 2.3 \cdot 10^{+163}:\\ \;\;\;\;\mathsf{fma}\left(t, a, \mathsf{fma}\left(z, \mathsf{fma}\left(b, a, y\right), x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a 2.3e+163) (fma t a (fma z (fma b a y) 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 (a <= 2.3e+163) {
		tmp = fma(t, a, fma(z, fma(b, a, y), x));
	} else {
		tmp = fma(fma(b, z, t), a, x);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= 2.3e+163)
		tmp = fma(t, a, fma(z, fma(b, a, y), x));
	else
		tmp = fma(fma(b, z, t), a, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 2.3e+163], N[(t * a + N[(z * N[(b * a + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;a \leq 2.3 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t, a, \mathsf{fma}\left(z, \mathsf{fma}\left(b, a, y\right), x\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.30000000000000002e163

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.30000000000000002e163 < a

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot t + a \cdot \left(b \cdot z\right)\right) + x \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

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

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

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

Alternative 2: 88.2% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;a \leq 1.1 \cdot 10^{+163}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.12000000000000006e63 or 1.09999999999999993e163 < a

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot t + a \cdot \left(b \cdot z\right)\right) + x \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

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

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

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

    if -1.12000000000000006e63 < a < 6.0000000000000004e68

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

    if 6.0000000000000004e68 < a < 1.09999999999999993e163

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

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

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

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

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

        \[\leadsto x + z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
    12. Applied rewrites74.3%

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

Alternative 3: 85.9% accurate, 1.1× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.09999999999999991e-36

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, a, \left(b \cdot a + y\right) \cdot z\right) \]
      8. lower-fma.f6471.1

        \[\leadsto \mathsf{fma}\left(t, a, \mathsf{fma}\left(b, a, y\right) \cdot z\right) \]
    8. Applied rewrites71.1%

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

    if -2.09999999999999991e-36 < z < 1.24999999999999995e27

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

    if 1.24999999999999995e27 < z

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

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

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

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

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

        \[\leadsto x + z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
    12. Applied rewrites74.3%

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

Alternative 4: 85.8% accurate, 1.1× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.12000000000000006e63 or 2.9500000000000002 < a

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot t + a \cdot \left(b \cdot z\right)\right) + x \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

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

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

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

    if -1.12000000000000006e63 < a < 2.9500000000000002

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

Alternative 5: 81.0% accurate, 1.1× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.7000000000000001e136 or 1.71999999999999996e59 < y

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

      \[\leadsto a \cdot t + \color{blue}{y \cdot z} \]
    11. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a, t, y \cdot z\right) \]
      2. lower-*.f6452.5

        \[\leadsto \mathsf{fma}\left(a, t, y \cdot z\right) \]
    12. Applied rewrites52.5%

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

    if -3.7000000000000001e136 < y < 1.71999999999999996e59

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot t + a \cdot \left(b \cdot z\right)\right) + x \]
      5. distribute-lft-outN/A

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

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

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

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

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

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

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

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

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

Alternative 6: 73.9% accurate, 1.3× speedup?

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6e-29 or 1.25e-9 < z

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b \cdot a + y\right) \cdot z \]
      8. lift-fma.f6449.9

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

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

    if -1.6e-29 < z < 1.25e-9

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + a \cdot \color{blue}{t} \]
    9. Applied rewrites53.0%

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

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

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

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

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

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

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

Alternative 7: 64.6% accurate, 1.3× speedup?

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

\mathbf{elif}\;t \leq 1.35 \cdot 10^{+53}:\\
\;\;\;\;x + y \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.8e53 or 1.3500000000000001e53 < t

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \mathsf{fma}\left(a, t, y \cdot z\right) \]
    9. Applied rewrites77.2%

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

      \[\leadsto a \cdot t + \color{blue}{y \cdot z} \]
    11. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a, t, y \cdot z\right) \]
      2. lower-*.f6452.5

        \[\leadsto \mathsf{fma}\left(a, t, y \cdot z\right) \]
    12. Applied rewrites52.5%

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

    if -1.8e53 < t < 1.3500000000000001e53

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.9% accurate, 1.5× speedup?

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

\mathbf{elif}\;t \leq 66000000000000:\\
\;\;\;\;x + y \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.60000000000000039e53 or 6.6e13 < t

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + a \cdot \color{blue}{t} \]
    9. Applied rewrites53.0%

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

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

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

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

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

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

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

    if -4.60000000000000039e53 < t < 6.6e13

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 58.5% accurate, 1.6× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.79999999999999973e118 or 2.15000000000000016e119 < y

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.79999999999999973e118 < y < 2.15000000000000016e119

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + a \cdot \color{blue}{t} \]
    9. Applied rewrites53.0%

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

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

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

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

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

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

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

Alternative 10: 39.3% accurate, 1.8× speedup?

\[\begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{+53}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;t \leq 66000000000000:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t -4.6e+53) (* a t) (if (<= t 66000000000000.0) (* y z) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -4.6e+53) {
		tmp = a * t;
	} else if (t <= 66000000000000.0) {
		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 (t <= (-4.6d+53)) then
        tmp = a * t
    else if (t <= 66000000000000.0d0) 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 (t <= -4.6e+53) {
		tmp = a * t;
	} else if (t <= 66000000000000.0) {
		tmp = y * z;
	} else {
		tmp = a * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if t <= -4.6e+53:
		tmp = a * t
	elif t <= 66000000000000.0:
		tmp = y * z
	else:
		tmp = a * t
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= -4.6e+53)
		tmp = Float64(a * t);
	elseif (t <= 66000000000000.0)
		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 (t <= -4.6e+53)
		tmp = a * t;
	elseif (t <= 66000000000000.0)
		tmp = y * z;
	else
		tmp = a * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.6e+53], N[(a * t), $MachinePrecision], If[LessEqual[t, 66000000000000.0], N[(y * z), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+53}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;t \leq 66000000000000:\\
\;\;\;\;y \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.60000000000000039e53 or 6.6e13 < t

    1. Initial program 92.3%

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

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

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

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

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

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

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

        \[\leadsto a \cdot t \]

      if -4.60000000000000039e53 < t < 6.6e13

      1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 37.9% accurate, 1.8× speedup?

    \[\begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-91}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (if (<= z -4.5e-11) (* y z) (if (<= z 2.9e-91) x (* y z))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double tmp;
    	if (z <= -4.5e-11) {
    		tmp = y * z;
    	} else if (z <= 2.9e-91) {
    		tmp = x;
    	} else {
    		tmp = y * z;
    	}
    	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 (z <= (-4.5d-11)) then
            tmp = y * z
        else if (z <= 2.9d-91) then
            tmp = x
        else
            tmp = y * z
        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 (z <= -4.5e-11) {
    		tmp = y * z;
    	} else if (z <= 2.9e-91) {
    		tmp = x;
    	} else {
    		tmp = y * z;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	tmp = 0
    	if z <= -4.5e-11:
    		tmp = y * z
    	elif z <= 2.9e-91:
    		tmp = x
    	else:
    		tmp = y * z
    	return tmp
    
    function code(x, y, z, t, a, b)
    	tmp = 0.0
    	if (z <= -4.5e-11)
    		tmp = Float64(y * z);
    	elseif (z <= 2.9e-91)
    		tmp = x;
    	else
    		tmp = Float64(y * z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	tmp = 0.0;
    	if (z <= -4.5e-11)
    		tmp = y * z;
    	elseif (z <= 2.9e-91)
    		tmp = x;
    	else
    		tmp = y * z;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.5e-11], N[(y * z), $MachinePrecision], If[LessEqual[z, 2.9e-91], x, N[(y * z), $MachinePrecision]]]
    
    \begin{array}{l}
    \mathbf{if}\;z \leq -4.5 \cdot 10^{-11}:\\
    \;\;\;\;y \cdot z\\
    
    \mathbf{elif}\;z \leq 2.9 \cdot 10^{-91}:\\
    \;\;\;\;x\\
    
    \mathbf{else}:\\
    \;\;\;\;y \cdot z\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -4.5e-11 or 2.9000000000000001e-91 < z

      1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.5e-11 < z < 2.9000000000000001e-91

      1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x} \]
      8. Step-by-step derivation
        1. Applied rewrites26.6%

          \[\leadsto \color{blue}{x} \]
      9. Recombined 2 regimes into one program.
      10. Add Preprocessing

      Alternative 12: 26.6% accurate, 21.0× speedup?

      \[x \]
      (FPCore (x y z t a b) :precision binary64 x)
      double code(double x, double y, double z, double t, double a, double b) {
      	return x;
      }
      
      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
      end function
      
      public static double code(double x, double y, double z, double t, double a, double b) {
      	return x;
      }
      
      def code(x, y, z, t, a, b):
      	return x
      
      function code(x, y, z, t, a, b)
      	return x
      end
      
      function tmp = code(x, y, z, t, a, b)
      	tmp = x;
      end
      
      code[x_, y_, z_, t_, a_, b_] := x
      
      x
      
      Derivation
      1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x} \]
      8. Step-by-step derivation
        1. Applied rewrites26.6%

          \[\leadsto \color{blue}{x} \]
        2. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025167 
        (FPCore (x y z t a b)
          :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
          :precision binary64
          (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))