Linear.V4:$cdot from linear-1.19.1.3, C

Percentage Accurate: 95.7% → 97.9%
Time: 4.1s
Alternatives: 13
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 95.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(b, a, t \cdot z\right)\right) + c \cdot i\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(b, a, t \cdot z\right)}\right) + c \cdot i \]
      13. lower-*.f64100.0

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

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
    4. Step-by-step derivation
      1. Applied rewrites76.2%

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

    Alternative 2: 66.4% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\ t_2 := \mathsf{fma}\left(i, c, t \cdot z\right)\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+158}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \cdot t \leq -500000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-236}:\\ \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\ \mathbf{elif}\;z \cdot t \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-145}:\\ \;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (x y z t a b c i)
     :precision binary64
     (let* ((t_1 (fma b a (* y x))) (t_2 (fma i c (* t z))))
       (if (<= (* z t) -2e+158)
         t_2
         (if (<= (* z t) -500000000.0)
           t_1
           (if (<= (* z t) -2e-236)
             (fma i c (* a b))
             (if (<= (* z t) 0.0)
               t_1
               (if (<= (* z t) 2e-145)
                 (fma i c (* x y))
                 (if (<= (* z t) 5e+17) t_1 t_2))))))))
    double code(double x, double y, double z, double t, double a, double b, double c, double i) {
    	double t_1 = fma(b, a, (y * x));
    	double t_2 = fma(i, c, (t * z));
    	double tmp;
    	if ((z * t) <= -2e+158) {
    		tmp = t_2;
    	} else if ((z * t) <= -500000000.0) {
    		tmp = t_1;
    	} else if ((z * t) <= -2e-236) {
    		tmp = fma(i, c, (a * b));
    	} else if ((z * t) <= 0.0) {
    		tmp = t_1;
    	} else if ((z * t) <= 2e-145) {
    		tmp = fma(i, c, (x * y));
    	} else if ((z * t) <= 5e+17) {
    		tmp = t_1;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b, c, i)
    	t_1 = fma(b, a, Float64(y * x))
    	t_2 = fma(i, c, Float64(t * z))
    	tmp = 0.0
    	if (Float64(z * t) <= -2e+158)
    		tmp = t_2;
    	elseif (Float64(z * t) <= -500000000.0)
    		tmp = t_1;
    	elseif (Float64(z * t) <= -2e-236)
    		tmp = fma(i, c, Float64(a * b));
    	elseif (Float64(z * t) <= 0.0)
    		tmp = t_1;
    	elseif (Float64(z * t) <= 2e-145)
    		tmp = fma(i, c, Float64(x * y));
    	elseif (Float64(z * t) <= 5e+17)
    		tmp = t_1;
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+158], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -500000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -2e-236], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 0.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e-145], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+17], t$95$1, t$95$2]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\
    t_2 := \mathsf{fma}\left(i, c, t \cdot z\right)\\
    \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+158}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;z \cdot t \leq -500000000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-236}:\\
    \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
    
    \mathbf{elif}\;z \cdot t \leq 0:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-145}:\\
    \;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
    
    \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+17}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (*.f64 z t) < -1.99999999999999991e158 or 5e17 < (*.f64 z t)

      1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(b, a, t \cdot z\right)}\right) + c \cdot i \]
        13. lower-*.f6491.2

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

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

        \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
      6. Step-by-step derivation
        1. Applied rewrites75.4%

          \[\leadsto \color{blue}{z \cdot t} + c \cdot i \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{z \cdot t + c \cdot i} \]
          2. lift-*.f64N/A

            \[\leadsto z \cdot t + \color{blue}{c \cdot i} \]
          3. +-commutativeN/A

            \[\leadsto \color{blue}{c \cdot i + z \cdot t} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{i \cdot c} + z \cdot t \]
          5. lower-fma.f6477.6

            \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, z \cdot t\right)} \]
        3. Applied rewrites77.6%

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

        if -1.99999999999999991e158 < (*.f64 z t) < -5e8 or -2.0000000000000001e-236 < (*.f64 z t) < -0.0 or 1.99999999999999983e-145 < (*.f64 z t) < 5e17

        1. Initial program 93.3%

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

          \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
        4. Step-by-step derivation
          1. Applied rewrites87.0%

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

            \[\leadsto \mathsf{fma}\left(b, a, x \cdot y\right) \]
          3. Step-by-step derivation
            1. Applied rewrites81.2%

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

            if -5e8 < (*.f64 z t) < -2.0000000000000001e-236

            1. Initial program 95.5%

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

              \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
            4. Step-by-step derivation
              1. Applied rewrites71.3%

                \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
              2. Step-by-step derivation
                1. lift-+.f64N/A

                  \[\leadsto \color{blue}{b \cdot a + c \cdot i} \]
                2. lift-*.f64N/A

                  \[\leadsto b \cdot a + \color{blue}{c \cdot i} \]
                3. +-commutativeN/A

                  \[\leadsto \color{blue}{c \cdot i + b \cdot a} \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{i \cdot c} + b \cdot a \]
                5. lower-fma.f6475.8

                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, b \cdot a\right)} \]
              3. Applied rewrites75.8%

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

              if -0.0 < (*.f64 z t) < 1.99999999999999983e-145

              1. Initial program 96.8%

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

                \[\leadsto \color{blue}{x \cdot y} + c \cdot i \]
              4. Step-by-step derivation
                1. Applied rewrites84.0%

                  \[\leadsto \color{blue}{y \cdot x} + c \cdot i \]
                2. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{y \cdot x + c \cdot i} \]
                  2. lift-*.f64N/A

                    \[\leadsto y \cdot x + \color{blue}{c \cdot i} \]
                  3. +-commutativeN/A

                    \[\leadsto \color{blue}{c \cdot i + y \cdot x} \]
                  4. *-commutativeN/A

                    \[\leadsto \color{blue}{i \cdot c} + y \cdot x \]
                  5. lower-fma.f6484.0

                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, y \cdot x\right)} \]
                3. Applied rewrites84.0%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, x \cdot y\right)} \]
              5. Recombined 4 regimes into one program.
              6. Add Preprocessing

              Alternative 3: 43.3% accurate, 0.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+159}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-7}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \cdot t \leq 0:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-145}:\\ \;\;\;\;i \cdot c\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+93}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
              (FPCore (x y z t a b c i)
               :precision binary64
               (if (<= (* z t) -2e+159)
                 (* t z)
                 (if (<= (* z t) -2e-7)
                   (* y x)
                   (if (<= (* z t) 0.0)
                     (* b a)
                     (if (<= (* z t) 2e-145)
                       (* i c)
                       (if (<= (* z t) 2e+93) (* y x) (* t z)))))))
              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
              	double tmp;
              	if ((z * t) <= -2e+159) {
              		tmp = t * z;
              	} else if ((z * t) <= -2e-7) {
              		tmp = y * x;
              	} else if ((z * t) <= 0.0) {
              		tmp = b * a;
              	} else if ((z * t) <= 2e-145) {
              		tmp = i * c;
              	} else if ((z * t) <= 2e+93) {
              		tmp = y * x;
              	} else {
              		tmp = t * 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, c, i)
              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), intent (in) :: c
                  real(8), intent (in) :: i
                  real(8) :: tmp
                  if ((z * t) <= (-2d+159)) then
                      tmp = t * z
                  else if ((z * t) <= (-2d-7)) then
                      tmp = y * x
                  else if ((z * t) <= 0.0d0) then
                      tmp = b * a
                  else if ((z * t) <= 2d-145) then
                      tmp = i * c
                  else if ((z * t) <= 2d+93) then
                      tmp = y * x
                  else
                      tmp = t * z
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
              	double tmp;
              	if ((z * t) <= -2e+159) {
              		tmp = t * z;
              	} else if ((z * t) <= -2e-7) {
              		tmp = y * x;
              	} else if ((z * t) <= 0.0) {
              		tmp = b * a;
              	} else if ((z * t) <= 2e-145) {
              		tmp = i * c;
              	} else if ((z * t) <= 2e+93) {
              		tmp = y * x;
              	} else {
              		tmp = t * z;
              	}
              	return tmp;
              }
              
              def code(x, y, z, t, a, b, c, i):
              	tmp = 0
              	if (z * t) <= -2e+159:
              		tmp = t * z
              	elif (z * t) <= -2e-7:
              		tmp = y * x
              	elif (z * t) <= 0.0:
              		tmp = b * a
              	elif (z * t) <= 2e-145:
              		tmp = i * c
              	elif (z * t) <= 2e+93:
              		tmp = y * x
              	else:
              		tmp = t * z
              	return tmp
              
              function code(x, y, z, t, a, b, c, i)
              	tmp = 0.0
              	if (Float64(z * t) <= -2e+159)
              		tmp = Float64(t * z);
              	elseif (Float64(z * t) <= -2e-7)
              		tmp = Float64(y * x);
              	elseif (Float64(z * t) <= 0.0)
              		tmp = Float64(b * a);
              	elseif (Float64(z * t) <= 2e-145)
              		tmp = Float64(i * c);
              	elseif (Float64(z * t) <= 2e+93)
              		tmp = Float64(y * x);
              	else
              		tmp = Float64(t * z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t, a, b, c, i)
              	tmp = 0.0;
              	if ((z * t) <= -2e+159)
              		tmp = t * z;
              	elseif ((z * t) <= -2e-7)
              		tmp = y * x;
              	elseif ((z * t) <= 0.0)
              		tmp = b * a;
              	elseif ((z * t) <= 2e-145)
              		tmp = i * c;
              	elseif ((z * t) <= 2e+93)
              		tmp = y * x;
              	else
              		tmp = t * z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+159], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -2e-7], N[(y * x), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 0.0], N[(b * a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-145], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+93], N[(y * x), $MachinePrecision], N[(t * z), $MachinePrecision]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+159}:\\
              \;\;\;\;t \cdot z\\
              
              \mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-7}:\\
              \;\;\;\;y \cdot x\\
              
              \mathbf{elif}\;z \cdot t \leq 0:\\
              \;\;\;\;b \cdot a\\
              
              \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-145}:\\
              \;\;\;\;i \cdot c\\
              
              \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+93}:\\
              \;\;\;\;y \cdot x\\
              
              \mathbf{else}:\\
              \;\;\;\;t \cdot z\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if (*.f64 z t) < -1.9999999999999999e159 or 2.00000000000000009e93 < (*.f64 z t)

                1. Initial program 85.3%

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

                  \[\leadsto \color{blue}{t \cdot z} \]
                4. Step-by-step derivation
                  1. Applied rewrites68.2%

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

                  if -1.9999999999999999e159 < (*.f64 z t) < -1.9999999999999999e-7 or 1.99999999999999983e-145 < (*.f64 z t) < 2.00000000000000009e93

                  1. Initial program 90.6%

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

                    \[\leadsto \color{blue}{x \cdot y} \]
                  4. Step-by-step derivation
                    1. Applied rewrites51.0%

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

                    if -1.9999999999999999e-7 < (*.f64 z t) < -0.0

                    1. Initial program 97.5%

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

                      \[\leadsto \color{blue}{a \cdot b} \]
                    4. Step-by-step derivation
                      1. Applied rewrites46.2%

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

                      if -0.0 < (*.f64 z t) < 1.99999999999999983e-145

                      1. Initial program 96.8%

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

                        \[\leadsto \color{blue}{c \cdot i} \]
                      4. Step-by-step derivation
                        1. Applied rewrites59.4%

                          \[\leadsto \color{blue}{i \cdot c} \]
                      5. Recombined 4 regimes into one program.
                      6. Add Preprocessing

                      Alternative 4: 66.9% accurate, 0.5× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\ t_2 := \mathsf{fma}\left(i, c, t \cdot z\right)\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+158}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \cdot t \leq -500000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-115}:\\ \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                      (FPCore (x y z t a b c i)
                       :precision binary64
                       (let* ((t_1 (fma b a (* y x))) (t_2 (fma i c (* t z))))
                         (if (<= (* z t) -2e+158)
                           t_2
                           (if (<= (* z t) -500000000.0)
                             t_1
                             (if (<= (* z t) 5e-115)
                               (fma i c (* a b))
                               (if (<= (* z t) 5e+17) t_1 t_2))))))
                      double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                      	double t_1 = fma(b, a, (y * x));
                      	double t_2 = fma(i, c, (t * z));
                      	double tmp;
                      	if ((z * t) <= -2e+158) {
                      		tmp = t_2;
                      	} else if ((z * t) <= -500000000.0) {
                      		tmp = t_1;
                      	} else if ((z * t) <= 5e-115) {
                      		tmp = fma(i, c, (a * b));
                      	} else if ((z * t) <= 5e+17) {
                      		tmp = t_1;
                      	} else {
                      		tmp = t_2;
                      	}
                      	return tmp;
                      }
                      
                      function code(x, y, z, t, a, b, c, i)
                      	t_1 = fma(b, a, Float64(y * x))
                      	t_2 = fma(i, c, Float64(t * z))
                      	tmp = 0.0
                      	if (Float64(z * t) <= -2e+158)
                      		tmp = t_2;
                      	elseif (Float64(z * t) <= -500000000.0)
                      		tmp = t_1;
                      	elseif (Float64(z * t) <= 5e-115)
                      		tmp = fma(i, c, Float64(a * b));
                      	elseif (Float64(z * t) <= 5e+17)
                      		tmp = t_1;
                      	else
                      		tmp = t_2;
                      	end
                      	return tmp
                      end
                      
                      code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+158], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -500000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-115], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+17], t$95$1, t$95$2]]]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\
                      t_2 := \mathsf{fma}\left(i, c, t \cdot z\right)\\
                      \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+158}:\\
                      \;\;\;\;t\_2\\
                      
                      \mathbf{elif}\;z \cdot t \leq -500000000:\\
                      \;\;\;\;t\_1\\
                      
                      \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-115}:\\
                      \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
                      
                      \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+17}:\\
                      \;\;\;\;t\_1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_2\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (*.f64 z t) < -1.99999999999999991e158 or 5e17 < (*.f64 z t)

                        1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(b, a, t \cdot z\right)}\right) + c \cdot i \]
                          13. lower-*.f6491.2

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

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

                          \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
                        6. Step-by-step derivation
                          1. Applied rewrites75.4%

                            \[\leadsto \color{blue}{z \cdot t} + c \cdot i \]
                          2. Step-by-step derivation
                            1. lift-+.f64N/A

                              \[\leadsto \color{blue}{z \cdot t + c \cdot i} \]
                            2. lift-*.f64N/A

                              \[\leadsto z \cdot t + \color{blue}{c \cdot i} \]
                            3. +-commutativeN/A

                              \[\leadsto \color{blue}{c \cdot i + z \cdot t} \]
                            4. *-commutativeN/A

                              \[\leadsto \color{blue}{i \cdot c} + z \cdot t \]
                            5. lower-fma.f6477.6

                              \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, z \cdot t\right)} \]
                          3. Applied rewrites77.6%

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

                          if -1.99999999999999991e158 < (*.f64 z t) < -5e8 or 5.0000000000000003e-115 < (*.f64 z t) < 5e17

                          1. Initial program 87.9%

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

                            \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                          4. Step-by-step derivation
                            1. Applied rewrites90.3%

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

                              \[\leadsto \mathsf{fma}\left(b, a, x \cdot y\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites79.8%

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

                              if -5e8 < (*.f64 z t) < 5.0000000000000003e-115

                              1. Initial program 97.4%

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

                                \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
                              4. Step-by-step derivation
                                1. Applied rewrites70.6%

                                  \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
                                2. Step-by-step derivation
                                  1. lift-+.f64N/A

                                    \[\leadsto \color{blue}{b \cdot a + c \cdot i} \]
                                  2. lift-*.f64N/A

                                    \[\leadsto b \cdot a + \color{blue}{c \cdot i} \]
                                  3. +-commutativeN/A

                                    \[\leadsto \color{blue}{c \cdot i + b \cdot a} \]
                                  4. *-commutativeN/A

                                    \[\leadsto \color{blue}{i \cdot c} + b \cdot a \]
                                  5. lower-fma.f6472.3

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, b \cdot a\right)} \]
                                3. Applied rewrites72.3%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, a \cdot b\right)} \]
                              5. Recombined 3 regimes into one program.
                              6. Add Preprocessing

                              Alternative 5: 67.1% accurate, 0.5× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\ t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+159}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \cdot t \leq -500000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-115}:\\ \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+93}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                              (FPCore (x y z t a b c i)
                               :precision binary64
                               (let* ((t_1 (fma b a (* y x))) (t_2 (fma b a (* t z))))
                                 (if (<= (* z t) -2e+159)
                                   t_2
                                   (if (<= (* z t) -500000000.0)
                                     t_1
                                     (if (<= (* z t) 5e-115)
                                       (fma i c (* a b))
                                       (if (<= (* z t) 2e+93) t_1 t_2))))))
                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                              	double t_1 = fma(b, a, (y * x));
                              	double t_2 = fma(b, a, (t * z));
                              	double tmp;
                              	if ((z * t) <= -2e+159) {
                              		tmp = t_2;
                              	} else if ((z * t) <= -500000000.0) {
                              		tmp = t_1;
                              	} else if ((z * t) <= 5e-115) {
                              		tmp = fma(i, c, (a * b));
                              	} else if ((z * t) <= 2e+93) {
                              		tmp = t_1;
                              	} else {
                              		tmp = t_2;
                              	}
                              	return tmp;
                              }
                              
                              function code(x, y, z, t, a, b, c, i)
                              	t_1 = fma(b, a, Float64(y * x))
                              	t_2 = fma(b, a, Float64(t * z))
                              	tmp = 0.0
                              	if (Float64(z * t) <= -2e+159)
                              		tmp = t_2;
                              	elseif (Float64(z * t) <= -500000000.0)
                              		tmp = t_1;
                              	elseif (Float64(z * t) <= 5e-115)
                              		tmp = fma(i, c, Float64(a * b));
                              	elseif (Float64(z * t) <= 2e+93)
                              		tmp = t_1;
                              	else
                              		tmp = t_2;
                              	end
                              	return tmp
                              end
                              
                              code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+159], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -500000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-115], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+93], t$95$1, t$95$2]]]]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\
                              t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
                              \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+159}:\\
                              \;\;\;\;t\_2\\
                              
                              \mathbf{elif}\;z \cdot t \leq -500000000:\\
                              \;\;\;\;t\_1\\
                              
                              \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-115}:\\
                              \;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
                              
                              \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+93}:\\
                              \;\;\;\;t\_1\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_2\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if (*.f64 z t) < -1.9999999999999999e159 or 2.00000000000000009e93 < (*.f64 z t)

                                1. Initial program 85.3%

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

                                  \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites84.5%

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

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

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

                                    if -1.9999999999999999e159 < (*.f64 z t) < -5e8 or 5.0000000000000003e-115 < (*.f64 z t) < 2.00000000000000009e93

                                    1. Initial program 89.8%

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

                                      \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites85.3%

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

                                        \[\leadsto \mathsf{fma}\left(b, a, x \cdot y\right) \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites73.2%

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

                                        if -5e8 < (*.f64 z t) < 5.0000000000000003e-115

                                        1. Initial program 97.4%

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

                                          \[\leadsto \color{blue}{a \cdot b} + c \cdot i \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites70.6%

                                            \[\leadsto \color{blue}{b \cdot a} + c \cdot i \]
                                          2. Step-by-step derivation
                                            1. lift-+.f64N/A

                                              \[\leadsto \color{blue}{b \cdot a + c \cdot i} \]
                                            2. lift-*.f64N/A

                                              \[\leadsto b \cdot a + \color{blue}{c \cdot i} \]
                                            3. +-commutativeN/A

                                              \[\leadsto \color{blue}{c \cdot i + b \cdot a} \]
                                            4. *-commutativeN/A

                                              \[\leadsto \color{blue}{i \cdot c} + b \cdot a \]
                                            5. lower-fma.f6472.3

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, b \cdot a\right)} \]
                                          3. Applied rewrites72.3%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, a \cdot b\right)} \]
                                        5. Recombined 3 regimes into one program.
                                        6. Add Preprocessing

                                        Alternative 6: 89.8% accurate, 0.7× speedup?

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

                                          1. Initial program 86.0%

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

                                            \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites85.3%

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

                                            if -4.99999999999999972e71 < (*.f64 z t) < 1.00000000000000009e56

                                            1. Initial program 95.1%

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

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

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{\mathsf{fma}\left(b, a, t \cdot z\right)}\right) + c \cdot i \]
                                              13. lower-*.f6495.1

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

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

                                              \[\leadsto \mathsf{fma}\left(y, x, \color{blue}{a \cdot b}\right) + c \cdot i \]
                                            6. Step-by-step derivation
                                              1. Applied rewrites90.6%

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

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

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

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

                                                  \[\leadsto \color{blue}{i \cdot c} + \mathsf{fma}\left(y, x, a \cdot b\right) \]
                                                5. lower-fma.f6494.9

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, \mathsf{fma}\left(y, x, a \cdot b\right)\right)} \]
                                              3. Applied rewrites94.9%

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, \mathsf{fma}\left(y, x, b \cdot a\right)\right)} \]
                                            7. Recombined 2 regimes into one program.
                                            8. Final simplification91.4%

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

                                            Alternative 7: 89.8% accurate, 0.7× speedup?

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

                                              1. Initial program 86.0%

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

                                                \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                              4. Step-by-step derivation
                                                1. Applied rewrites85.3%

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

                                                if -4.99999999999999972e71 < (*.f64 z t) < 1.00000000000000009e56

                                                1. Initial program 95.1%

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

                                                  \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
                                                4. Step-by-step derivation
                                                  1. Applied rewrites92.5%

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)} \]
                                                5. Recombined 2 regimes into one program.
                                                6. Final simplification89.9%

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

                                                Alternative 8: 85.9% accurate, 0.7× speedup?

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

                                                  1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \color{blue}{t \cdot z} + c \cdot i \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites77.8%

                                                      \[\leadsto \color{blue}{z \cdot t} + c \cdot i \]
                                                    2. Step-by-step derivation
                                                      1. lift-+.f64N/A

                                                        \[\leadsto \color{blue}{z \cdot t + c \cdot i} \]
                                                      2. lift-*.f64N/A

                                                        \[\leadsto z \cdot t + \color{blue}{c \cdot i} \]
                                                      3. +-commutativeN/A

                                                        \[\leadsto \color{blue}{c \cdot i + z \cdot t} \]
                                                      4. *-commutativeN/A

                                                        \[\leadsto \color{blue}{i \cdot c} + z \cdot t \]
                                                      5. lower-fma.f6480.4

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(i, c, z \cdot t\right)} \]
                                                    3. Applied rewrites80.4%

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

                                                    if -1.9999999999999999e159 < (*.f64 z t) < 4.99999999999999989e101

                                                    1. Initial program 94.9%

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

                                                      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites91.0%

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)} \]
                                                    5. Recombined 2 regimes into one program.
                                                    6. Final simplification87.8%

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

                                                    Alternative 9: 43.5% accurate, 0.8× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+24}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq 0:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;z \cdot t \leq 10^{+56}:\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
                                                    (FPCore (x y z t a b c i)
                                                     :precision binary64
                                                     (if (<= (* z t) -1e+24)
                                                       (* t z)
                                                       (if (<= (* z t) 0.0) (* b a) (if (<= (* z t) 1e+56) (* i c) (* t z)))))
                                                    double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                    	double tmp;
                                                    	if ((z * t) <= -1e+24) {
                                                    		tmp = t * z;
                                                    	} else if ((z * t) <= 0.0) {
                                                    		tmp = b * a;
                                                    	} else if ((z * t) <= 1e+56) {
                                                    		tmp = i * c;
                                                    	} else {
                                                    		tmp = t * 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, c, i)
                                                    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), intent (in) :: c
                                                        real(8), intent (in) :: i
                                                        real(8) :: tmp
                                                        if ((z * t) <= (-1d+24)) then
                                                            tmp = t * z
                                                        else if ((z * t) <= 0.0d0) then
                                                            tmp = b * a
                                                        else if ((z * t) <= 1d+56) then
                                                            tmp = i * c
                                                        else
                                                            tmp = t * z
                                                        end if
                                                        code = tmp
                                                    end function
                                                    
                                                    public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                    	double tmp;
                                                    	if ((z * t) <= -1e+24) {
                                                    		tmp = t * z;
                                                    	} else if ((z * t) <= 0.0) {
                                                    		tmp = b * a;
                                                    	} else if ((z * t) <= 1e+56) {
                                                    		tmp = i * c;
                                                    	} else {
                                                    		tmp = t * z;
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    def code(x, y, z, t, a, b, c, i):
                                                    	tmp = 0
                                                    	if (z * t) <= -1e+24:
                                                    		tmp = t * z
                                                    	elif (z * t) <= 0.0:
                                                    		tmp = b * a
                                                    	elif (z * t) <= 1e+56:
                                                    		tmp = i * c
                                                    	else:
                                                    		tmp = t * z
                                                    	return tmp
                                                    
                                                    function code(x, y, z, t, a, b, c, i)
                                                    	tmp = 0.0
                                                    	if (Float64(z * t) <= -1e+24)
                                                    		tmp = Float64(t * z);
                                                    	elseif (Float64(z * t) <= 0.0)
                                                    		tmp = Float64(b * a);
                                                    	elseif (Float64(z * t) <= 1e+56)
                                                    		tmp = Float64(i * c);
                                                    	else
                                                    		tmp = Float64(t * z);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    function tmp_2 = code(x, y, z, t, a, b, c, i)
                                                    	tmp = 0.0;
                                                    	if ((z * t) <= -1e+24)
                                                    		tmp = t * z;
                                                    	elseif ((z * t) <= 0.0)
                                                    		tmp = b * a;
                                                    	elseif ((z * t) <= 1e+56)
                                                    		tmp = i * c;
                                                    	else
                                                    		tmp = t * z;
                                                    	end
                                                    	tmp_2 = tmp;
                                                    end
                                                    
                                                    code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+24], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 0.0], N[(b * a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+56], N[(i * c), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+24}:\\
                                                    \;\;\;\;t \cdot z\\
                                                    
                                                    \mathbf{elif}\;z \cdot t \leq 0:\\
                                                    \;\;\;\;b \cdot a\\
                                                    
                                                    \mathbf{elif}\;z \cdot t \leq 10^{+56}:\\
                                                    \;\;\;\;i \cdot c\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;t \cdot z\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if (*.f64 z t) < -9.9999999999999998e23 or 1.00000000000000009e56 < (*.f64 z t)

                                                      1. Initial program 86.4%

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

                                                        \[\leadsto \color{blue}{t \cdot z} \]
                                                      4. Step-by-step derivation
                                                        1. Applied rewrites59.0%

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

                                                        if -9.9999999999999998e23 < (*.f64 z t) < -0.0

                                                        1. Initial program 96.5%

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

                                                          \[\leadsto \color{blue}{a \cdot b} \]
                                                        4. Step-by-step derivation
                                                          1. Applied rewrites45.4%

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

                                                          if -0.0 < (*.f64 z t) < 1.00000000000000009e56

                                                          1. Initial program 94.1%

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

                                                            \[\leadsto \color{blue}{c \cdot i} \]
                                                          4. Step-by-step derivation
                                                            1. Applied rewrites38.0%

                                                              \[\leadsto \color{blue}{i \cdot c} \]
                                                          5. Recombined 3 regimes into one program.
                                                          6. Add Preprocessing

                                                          Alternative 10: 66.9% accurate, 0.9× speedup?

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

                                                            1. Initial program 85.3%

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

                                                              \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                                            4. Step-by-step derivation
                                                              1. Applied rewrites84.5%

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

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

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

                                                                if -1.9999999999999999e159 < (*.f64 z t) < 2.00000000000000009e93

                                                                1. Initial program 94.8%

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

                                                                  \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. Applied rewrites72.4%

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

                                                                    \[\leadsto \mathsf{fma}\left(b, a, x \cdot y\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites66.6%

                                                                      \[\leadsto \mathsf{fma}\left(b, a, y \cdot x\right) \]
                                                                  4. Recombined 2 regimes into one program.
                                                                  5. Final simplification70.1%

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

                                                                  Alternative 11: 64.1% accurate, 0.9× speedup?

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

                                                                    1. Initial program 85.7%

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

                                                                      \[\leadsto \color{blue}{x \cdot y} \]
                                                                    4. Step-by-step derivation
                                                                      1. Applied rewrites68.1%

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

                                                                      if -3.99999999999999992e179 < (*.f64 x y) < 1.99999999999999995e102

                                                                      1. Initial program 94.7%

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

                                                                        \[\leadsto \color{blue}{a \cdot b + \left(t \cdot z + x \cdot y\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. Applied rewrites70.9%

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

                                                                          \[\leadsto \mathsf{fma}\left(b, a, t \cdot z\right) \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites62.4%

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

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

                                                                        Alternative 12: 42.8% accurate, 1.1× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+29} \lor \neg \left(a \cdot b \leq 10^{+152}\right):\\ \;\;\;\;b \cdot a\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                                                                        (FPCore (x y z t a b c i)
                                                                         :precision binary64
                                                                         (if (or (<= (* a b) -4e+29) (not (<= (* a b) 1e+152))) (* b a) (* i c)))
                                                                        double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                        	double tmp;
                                                                        	if (((a * b) <= -4e+29) || !((a * b) <= 1e+152)) {
                                                                        		tmp = b * a;
                                                                        	} else {
                                                                        		tmp = i * c;
                                                                        	}
                                                                        	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, c, i)
                                                                        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), intent (in) :: c
                                                                            real(8), intent (in) :: i
                                                                            real(8) :: tmp
                                                                            if (((a * b) <= (-4d+29)) .or. (.not. ((a * b) <= 1d+152))) then
                                                                                tmp = b * a
                                                                            else
                                                                                tmp = i * c
                                                                            end if
                                                                            code = tmp
                                                                        end function
                                                                        
                                                                        public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                        	double tmp;
                                                                        	if (((a * b) <= -4e+29) || !((a * b) <= 1e+152)) {
                                                                        		tmp = b * a;
                                                                        	} else {
                                                                        		tmp = i * c;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        def code(x, y, z, t, a, b, c, i):
                                                                        	tmp = 0
                                                                        	if ((a * b) <= -4e+29) or not ((a * b) <= 1e+152):
                                                                        		tmp = b * a
                                                                        	else:
                                                                        		tmp = i * c
                                                                        	return tmp
                                                                        
                                                                        function code(x, y, z, t, a, b, c, i)
                                                                        	tmp = 0.0
                                                                        	if ((Float64(a * b) <= -4e+29) || !(Float64(a * b) <= 1e+152))
                                                                        		tmp = Float64(b * a);
                                                                        	else
                                                                        		tmp = Float64(i * c);
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        function tmp_2 = code(x, y, z, t, a, b, c, i)
                                                                        	tmp = 0.0;
                                                                        	if (((a * b) <= -4e+29) || ~(((a * b) <= 1e+152)))
                                                                        		tmp = b * a;
                                                                        	else
                                                                        		tmp = i * c;
                                                                        	end
                                                                        	tmp_2 = tmp;
                                                                        end
                                                                        
                                                                        code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4e+29], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+152]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(i * c), $MachinePrecision]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+29} \lor \neg \left(a \cdot b \leq 10^{+152}\right):\\
                                                                        \;\;\;\;b \cdot a\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;i \cdot c\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 2 regimes
                                                                        2. if (*.f64 a b) < -3.99999999999999966e29 or 1e152 < (*.f64 a b)

                                                                          1. Initial program 87.2%

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

                                                                            \[\leadsto \color{blue}{a \cdot b} \]
                                                                          4. Step-by-step derivation
                                                                            1. Applied rewrites50.5%

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

                                                                            if -3.99999999999999966e29 < (*.f64 a b) < 1e152

                                                                            1. Initial program 94.8%

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

                                                                              \[\leadsto \color{blue}{c \cdot i} \]
                                                                            4. Step-by-step derivation
                                                                              1. Applied rewrites34.8%

                                                                                \[\leadsto \color{blue}{i \cdot c} \]
                                                                            5. Recombined 2 regimes into one program.
                                                                            6. Final simplification41.0%

                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+29} \lor \neg \left(a \cdot b \leq 10^{+152}\right):\\ \;\;\;\;b \cdot a\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
                                                                            7. Add Preprocessing

                                                                            Alternative 13: 28.1% accurate, 5.0× speedup?

                                                                            \[\begin{array}{l} \\ b \cdot a \end{array} \]
                                                                            (FPCore (x y z t a b c i) :precision binary64 (* b a))
                                                                            double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                            	return b * a;
                                                                            }
                                                                            
                                                                            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, c, i)
                                                                            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), intent (in) :: c
                                                                                real(8), intent (in) :: i
                                                                                code = b * a
                                                                            end function
                                                                            
                                                                            public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                                            	return b * a;
                                                                            }
                                                                            
                                                                            def code(x, y, z, t, a, b, c, i):
                                                                            	return b * a
                                                                            
                                                                            function code(x, y, z, t, a, b, c, i)
                                                                            	return Float64(b * a)
                                                                            end
                                                                            
                                                                            function tmp = code(x, y, z, t, a, b, c, i)
                                                                            	tmp = b * a;
                                                                            end
                                                                            
                                                                            code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(b * a), $MachinePrecision]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            b \cdot a
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Initial program 91.8%

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

                                                                              \[\leadsto \color{blue}{a \cdot b} \]
                                                                            4. Step-by-step derivation
                                                                              1. Applied rewrites25.4%

                                                                                \[\leadsto \color{blue}{b \cdot a} \]
                                                                              2. Add Preprocessing

                                                                              Reproduce

                                                                              ?
                                                                              herbie shell --seed 2025026 
                                                                              (FPCore (x y z t a b c i)
                                                                                :name "Linear.V4:$cdot from linear-1.19.1.3, C"
                                                                                :precision binary64
                                                                                (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))