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

Percentage Accurate: 95.9% → 97.9%
Time: 5.9s
Alternatives: 10
Speedup: 1.3×

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 10 alternatives:

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

Initial Program: 95.9% 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, 1.3× speedup?

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

\\
\mathsf{fma}\left(y, x, \mathsf{fma}\left(t, z, \mathsf{fma}\left(i, c, b \cdot a\right)\right)\right)
\end{array}
Derivation
  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. 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(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + \color{blue}{c \cdot i} \]
    3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, c, z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\

\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\

\mathbf{elif}\;a \cdot b \leq 5000000000:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 a b) < -1.00000000000000002e100

    1. Initial program 92.0%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
      14. lower-*.f6490.2

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

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

      \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
    7. Step-by-step derivation
      1. Applied rewrites82.4%

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

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

        if -1.00000000000000002e100 < (*.f64 a b) < -1.99999999999999989e-67 or -0.0 < (*.f64 a b) < 5e9

        1. Initial program 97.7%

          \[\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 0

          \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
        4. Step-by-step derivation
          1. *-lft-identityN/A

            \[\leadsto c \cdot i + \color{blue}{1 \cdot \left(t \cdot z + x \cdot y\right)} \]
          2. metadata-evalN/A

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

            \[\leadsto \color{blue}{i \cdot c} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(t \cdot z + x \cdot y\right) \]
          4. metadata-evalN/A

            \[\leadsto i \cdot c + \color{blue}{1} \cdot \left(t \cdot z + x \cdot y\right) \]
          5. *-lft-identityN/A

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

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

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

            \[\leadsto \mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, \color{blue}{y \cdot x}\right)\right) \]
          9. lower-*.f6489.8

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

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

          \[\leadsto \mathsf{fma}\left(i, c, t \cdot z\right) \]
        7. Step-by-step derivation
          1. Applied rewrites72.6%

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

          if -1.99999999999999989e-67 < (*.f64 a b) < -0.0

          1. Initial program 96.6%

            \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
            14. lower-*.f6474.4

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

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

            \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
          7. Step-by-step derivation
            1. Applied rewrites44.5%

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

              \[\leadsto a \cdot b \]
            3. Step-by-step derivation
              1. Applied rewrites3.8%

                \[\leadsto b \cdot a \]
              2. Taylor expanded in a around 0

                \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
              3. Step-by-step derivation
                1. Applied rewrites72.8%

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

                if 5e9 < (*.f64 a b)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                  14. lower-*.f6495.0

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

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

                  \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites84.3%

                    \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                8. Recombined 4 regimes into one program.
                9. Add Preprocessing

                Alternative 3: 89.9% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+80} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+130}\right):\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\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) -2e+80) (not (<= (* z t) 2e+130)))
                   (fma b a (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+80) || !((z * t) <= 2e+130)) {
                		tmp = fma(b, a, 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+80) || !(Float64(z * t) <= 2e+130))
                		tmp = fma(b, a, 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+80], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+130]], $MachinePrecision]], N[(b * a + N[(i * c + N[(t * z), $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 -2 \cdot 10^{+80} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+130}\right):\\
                \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\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) < -2e80 or 2.0000000000000001e130 < (*.f64 z t)

                  1. Initial program 92.0%

                    \[\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 0

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

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

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

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

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

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

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

                  if -2e80 < (*.f64 z t) < 2.0000000000000001e130

                  1. Initial program 98.8%

                    \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 4: 90.0% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\ \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+89}:\\ \;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b, z \cdot t\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 (<= (* c i) -1e+47)
                   (fma b a (fma i c (* t z)))
                   (if (<= (* c i) 2e+89)
                     (fma y x (fma a b (* z t)))
                     (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 ((c * i) <= -1e+47) {
                		tmp = fma(b, a, fma(i, c, (t * z)));
                	} else if ((c * i) <= 2e+89) {
                		tmp = fma(y, x, fma(a, b, (z * t)));
                	} 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(c * i) <= -1e+47)
                		tmp = fma(b, a, fma(i, c, Float64(t * z)));
                	elseif (Float64(c * i) <= 2e+89)
                		tmp = fma(y, x, fma(a, b, Float64(z * t)));
                	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[LessEqual[N[(c * i), $MachinePrecision], -1e+47], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+89], N[(y * x + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+47}:\\
                \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
                
                \mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+89}:\\
                \;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b, z \cdot t\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 3 regimes
                2. if (*.f64 c i) < -1e47

                  1. Initial program 93.5%

                    \[\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 0

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                    5. lower-*.f6488.8

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

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

                  if -1e47 < (*.f64 c i) < 1.99999999999999999e89

                  1. Initial program 97.3%

                    \[\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(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + \color{blue}{c \cdot i} \]
                    3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 1.99999999999999999e89 < (*.f64 c i)

                  1. Initial program 97.7%

                    \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                    14. lower-*.f6493.3

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

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

                Alternative 5: 84.8% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+295}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \cdot y \leq 10^{+136}:\\ \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\ \end{array} \end{array} \]
                (FPCore (x y z t a b c i)
                 :precision binary64
                 (if (<= (* x y) -4e+295)
                   (* y x)
                   (if (<= (* x y) 1e+136) (fma b a (fma i c (* t z))) (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 ((x * y) <= -4e+295) {
                		tmp = y * x;
                	} else if ((x * y) <= 1e+136) {
                		tmp = fma(b, a, fma(i, c, (t * z)));
                	} else {
                		tmp = fma(y, x, (b * a));
                	}
                	return tmp;
                }
                
                function code(x, y, z, t, a, b, c, i)
                	tmp = 0.0
                	if (Float64(x * y) <= -4e+295)
                		tmp = Float64(y * x);
                	elseif (Float64(x * y) <= 1e+136)
                		tmp = fma(b, a, fma(i, c, Float64(t * z)));
                	else
                		tmp = fma(y, x, Float64(b * a));
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+295], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+136], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+295}:\\
                \;\;\;\;y \cdot x\\
                
                \mathbf{elif}\;x \cdot y \leq 10^{+136}:\\
                \;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (*.f64 x y) < -3.9999999999999999e295

                  1. Initial program 94.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                  7. Step-by-step derivation
                    1. Applied rewrites94.4%

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

                      \[\leadsto a \cdot b \]
                    3. Step-by-step derivation
                      1. Applied rewrites7.7%

                        \[\leadsto b \cdot a \]
                      2. Taylor expanded in x around inf

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

                          \[\leadsto \color{blue}{y \cdot x} \]
                        2. lower-*.f6494.4

                          \[\leadsto \color{blue}{y \cdot x} \]
                      4. Applied rewrites94.4%

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

                      if -3.9999999999999999e295 < (*.f64 x y) < 1.00000000000000006e136

                      1. Initial program 98.0%

                        \[\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 0

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(b, a, \color{blue}{\mathsf{fma}\left(i, c, t \cdot z\right)}\right) \]
                        5. lower-*.f6489.4

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

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

                      if 1.00000000000000006e136 < (*.f64 x y)

                      1. Initial program 89.7%

                        \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                        14. lower-*.f6485.1

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

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

                        \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                      7. Step-by-step derivation
                        1. Applied rewrites77.5%

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

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

                        Alternative 6: 62.9% accurate, 0.9× speedup?

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

                          1. Initial program 94.2%

                            \[\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. *-commutativeN/A

                              \[\leadsto \color{blue}{i \cdot c} \]
                            2. lower-*.f6481.5

                              \[\leadsto \color{blue}{i \cdot c} \]
                          5. Applied rewrites81.5%

                            \[\leadsto \color{blue}{i \cdot c} \]

                          if -1.00000000000000002e95 < (*.f64 c i) < 4.00000000000000019e223

                          1. Initial program 97.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                            14. lower-*.f6473.2

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

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

                            \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                          7. Step-by-step derivation
                            1. Applied rewrites65.1%

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

                            \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+95} \lor \neg \left(c \cdot i \leq 4 \cdot 10^{+223}\right):\\ \;\;\;\;i \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\ \end{array} \]
                          10. Add Preprocessing

                          Alternative 7: 64.9% accurate, 0.9× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+95}:\\ \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\ \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+223}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                          (FPCore (x y z t a b c i)
                           :precision binary64
                           (if (<= (* c i) -1e+95)
                             (fma b a (* c i))
                             (if (<= (* c i) 4e+223) (fma a b (* x y)) (* i c))))
                          double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                          	double tmp;
                          	if ((c * i) <= -1e+95) {
                          		tmp = fma(b, a, (c * i));
                          	} else if ((c * i) <= 4e+223) {
                          		tmp = fma(a, b, (x * y));
                          	} else {
                          		tmp = i * c;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z, t, a, b, c, i)
                          	tmp = 0.0
                          	if (Float64(c * i) <= -1e+95)
                          		tmp = fma(b, a, Float64(c * i));
                          	elseif (Float64(c * i) <= 4e+223)
                          		tmp = fma(a, b, Float64(x * y));
                          	else
                          		tmp = Float64(i * c);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+95], N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4e+223], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(i * c), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+95}:\\
                          \;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\
                          
                          \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+223}:\\
                          \;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;i \cdot c\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if (*.f64 c i) < -1.00000000000000002e95

                            1. Initial program 92.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                              14. lower-*.f6486.4

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

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

                              \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
                            7. Step-by-step derivation
                              1. Applied rewrites86.1%

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

                              if -1.00000000000000002e95 < (*.f64 c i) < 4.00000000000000019e223

                              1. Initial program 97.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                14. lower-*.f6473.2

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

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

                                \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                              7. Step-by-step derivation
                                1. Applied rewrites65.1%

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

                                if 4.00000000000000019e223 < (*.f64 c i)

                                1. Initial program 99.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 inf

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

                                    \[\leadsto \color{blue}{i \cdot c} \]
                                  2. lower-*.f6495.5

                                    \[\leadsto \color{blue}{i \cdot c} \]
                                5. Applied rewrites95.5%

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

                              Alternative 8: 64.7% accurate, 0.9× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\ \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+223}:\\ \;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                              (FPCore (x y z t a b c i)
                               :precision binary64
                               (if (<= (* c i) -1e+47)
                                 (fma i c (* y x))
                                 (if (<= (* c i) 4e+223) (fma a b (* x y)) (* i c))))
                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                              	double tmp;
                              	if ((c * i) <= -1e+47) {
                              		tmp = fma(i, c, (y * x));
                              	} else if ((c * i) <= 4e+223) {
                              		tmp = fma(a, b, (x * y));
                              	} else {
                              		tmp = i * c;
                              	}
                              	return tmp;
                              }
                              
                              function code(x, y, z, t, a, b, c, i)
                              	tmp = 0.0
                              	if (Float64(c * i) <= -1e+47)
                              		tmp = fma(i, c, Float64(y * x));
                              	elseif (Float64(c * i) <= 4e+223)
                              		tmp = fma(a, b, Float64(x * y));
                              	else
                              		tmp = Float64(i * c);
                              	end
                              	return tmp
                              end
                              
                              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+47], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4e+223], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(i * c), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+47}:\\
                              \;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
                              
                              \mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+223}:\\
                              \;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;i \cdot c\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if (*.f64 c i) < -1e47

                                1. Initial program 93.5%

                                  \[\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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                  14. lower-*.f6485.7

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

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

                                  \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites26.2%

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

                                    \[\leadsto a \cdot b \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites14.8%

                                      \[\leadsto b \cdot a \]
                                    2. Taylor expanded in a around 0

                                      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites77.8%

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

                                      if -1e47 < (*.f64 c i) < 4.00000000000000019e223

                                      1. Initial program 97.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                        14. lower-*.f6472.6

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

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

                                        \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites66.2%

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

                                        if 4.00000000000000019e223 < (*.f64 c i)

                                        1. Initial program 99.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 inf

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

                                            \[\leadsto \color{blue}{i \cdot c} \]
                                          2. lower-*.f6495.5

                                            \[\leadsto \color{blue}{i \cdot c} \]
                                        5. Applied rewrites95.5%

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

                                      Alternative 9: 41.9% accurate, 1.1× speedup?

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

                                        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 c around inf

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

                                            \[\leadsto \color{blue}{i \cdot c} \]
                                          2. lower-*.f6473.7

                                            \[\leadsto \color{blue}{i \cdot c} \]
                                        5. Applied rewrites73.7%

                                          \[\leadsto \color{blue}{i \cdot c} \]

                                        if -2.00000000000000001e41 < (*.f64 c i) < 4.00000000000000019e223

                                        1. Initial program 97.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                          14. lower-*.f6472.3

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

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

                                          \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites65.8%

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

                                            \[\leadsto a \cdot b \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites38.5%

                                              \[\leadsto b \cdot a \]
                                          4. Recombined 2 regimes into one program.
                                          5. Final simplification49.8%

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

                                          Alternative 10: 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 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 z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              \[\leadsto \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, \color{blue}{y \cdot x}\right)\right) \]
                                            14. lower-*.f6477.4

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

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

                                            \[\leadsto a \cdot b + \color{blue}{x \cdot y} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites52.8%

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

                                              \[\leadsto a \cdot b \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites29.9%

                                                \[\leadsto b \cdot a \]
                                              2. Add Preprocessing

                                              Reproduce

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