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

Percentage Accurate: 95.8% → 98.0%
Time: 6.7s
Alternatives: 13
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 13 alternatives:

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

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

\[\begin{array}{l} \\ \mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \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 z t (fma y x (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(z, t, fma(y, x, fma(i, c, (b * a))));
}
function code(x, y, z, t, a, b, c, i)
	return fma(z, t, fma(y, x, fma(i, c, Float64(b * a))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(z * t + N[(y * x + N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.6% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-318}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1e167 or 2.0000000000000001e137 < (*.f64 z t)

    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 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.8

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

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

      \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
    7. Step-by-step derivation
      1. Applied rewrites86.4%

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

      if -1e167 < (*.f64 z t) < 2.0000024e-318

      1. Initial program 97.4%

        \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
      2. Add Preprocessing
      3. Taylor expanded in 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.3

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

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

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

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

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

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

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

            if 2.0000024e-318 < (*.f64 z t) < 2.0000000000000001e137

            1. Initial program 98.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-*.f6495.8

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

              \[\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 rewrites70.7%

                \[\leadsto \mathsf{fma}\left(b, a, c \cdot i\right) \]
            8. Recombined 3 regimes into one program.
            9. Final simplification76.1%

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

            Alternative 3: 66.6% accurate, 0.7× speedup?

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

              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 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.8

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

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

                \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
              7. Step-by-step derivation
                1. Applied rewrites86.4%

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

                if -1e167 < (*.f64 z t) < 2.0000024e-318

                1. Initial program 97.4%

                  \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                2. Add Preprocessing
                3. Taylor expanded in 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.3

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

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

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

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

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

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

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

                      if 2.0000024e-318 < (*.f64 z t) < 2.0000000000000001e137

                      1. Initial program 98.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-*.f6495.8

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(i, \color{blue}{c}, b \cdot a\right) \]
                        4. Recombined 3 regimes into one program.
                        5. Final simplification75.8%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+167}:\\ \;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-318}:\\ \;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\ \end{array} \]
                        6. Add Preprocessing

                        Alternative 4: 90.1% accurate, 0.7× speedup?

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

                          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 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-*.f6493.1

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

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

                          if -5.0000000000000001e94 < (*.f64 z t) < 4.0000000000000003e97

                          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-*.f6495.6

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

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

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

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

                          Alternative 5: 90.1% accurate, 0.7× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+94} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+97}\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) -5e+94) (not (<= (* z t) 4e+97)))
                             (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) <= -5e+94) || !((z * t) <= 4e+97)) {
                          		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) <= -5e+94) || !(Float64(z * t) <= 4e+97))
                          		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], -5e+94], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e+97]], $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 -5 \cdot 10^{+94} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+97}\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) < -5.0000000000000001e94 or 4.0000000000000003e97 < (*.f64 z t)

                            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 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-*.f6493.1

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

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

                            if -5.0000000000000001e94 < (*.f64 z t) < 4.0000000000000003e97

                            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-*.f6495.6

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

                              \[\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 simplification94.8%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+94} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{+97}\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 6: 90.3% accurate, 0.7× speedup?

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

                            1. Initial program 94.8%

                              \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                            2. Add Preprocessing
                            3. Taylor expanded in 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-*.f6492.8

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

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

                            if -5.0000000000000001e94 < (*.f64 z t) < 2.0000000000000001e137

                            1. Initial program 97.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-*.f6495.2

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

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

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

                              if 2.0000000000000001e137 < (*.f64 z t)

                              1. Initial program 94.6%

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

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

                                  \[\leadsto \left(\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. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 7: 86.2% accurate, 0.7× speedup?

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

                              1. Initial program 97.4%

                                \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
                              2. Add Preprocessing
                              3. Taylor expanded in 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-*.f6487.2

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

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

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

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

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

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

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

                                    if -5.0000000000000003e181 < (*.f64 x y) < 1.9999999999999999e159

                                    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 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.5

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

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

                                    if 1.9999999999999999e159 < (*.f64 x y)

                                    1. Initial program 89.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-*.f6491.5

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

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

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

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

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

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

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

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

                                        Alternative 8: 66.4% accurate, 0.9× speedup?

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

                                          1. Initial program 93.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-*.f6488.6

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

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

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

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

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

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

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

                                                if -5.0000000000000003e181 < (*.f64 x y) < 1.00000000000000006e140

                                                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-*.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. Step-by-step derivation
                                                  1. Applied rewrites73.9%

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

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

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

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

                                                  Alternative 9: 64.4% accurate, 0.9× speedup?

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

                                                    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 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-*.f6484.1

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

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

                                                    if -4.9999999999999998e213 < (*.f64 c i) < 1.00000000000000002e151

                                                    1. Initial program 97.9%

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

                                                      \[\leadsto \color{blue}{a \cdot b + \left(c \cdot i + x \cdot y\right)} \]
                                                    4. Step-by-step derivation
                                                      1. *-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.8

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

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

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

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

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

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

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

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

                                                        Alternative 10: 63.8% accurate, 0.9× speedup?

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

                                                          1. Initial program 93.3%

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

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

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

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

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

                                                          if -2.0000000000000001e221 < (*.f64 c i) < 5.00000000000000004e154

                                                          1. Initial program 97.9%

                                                            \[\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-*.f6468.2

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

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

                                                            \[\leadsto a \cdot b + \color{blue}{t \cdot z} \]
                                                          7. Step-by-step derivation
                                                            1. Applied rewrites58.1%

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

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

                                                          Alternative 11: 42.4% accurate, 1.1× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+181} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+141}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                                                          (FPCore (x y z t a b c i)
                                                           :precision binary64
                                                           (if (or (<= (* x y) -5e+181) (not (<= (* x y) 5e+141))) (* y x) (* i c)))
                                                          double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                          	double tmp;
                                                          	if (((x * y) <= -5e+181) || !((x * y) <= 5e+141)) {
                                                          		tmp = y * x;
                                                          	} else {
                                                          		tmp = i * c;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          module fmin_fmax_functions
                                                              implicit none
                                                              private
                                                              public fmax
                                                              public fmin
                                                          
                                                              interface fmax
                                                                  module procedure fmax88
                                                                  module procedure fmax44
                                                                  module procedure fmax84
                                                                  module procedure fmax48
                                                              end interface
                                                              interface fmin
                                                                  module procedure fmin88
                                                                  module procedure fmin44
                                                                  module procedure fmin84
                                                                  module procedure fmin48
                                                              end interface
                                                          contains
                                                              real(8) function fmax88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmax44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmin44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                              end function
                                                          end module
                                                          
                                                          real(8) function code(x, y, z, t, a, b, c, i)
                                                          use fmin_fmax_functions
                                                              real(8), intent (in) :: x
                                                              real(8), intent (in) :: y
                                                              real(8), intent (in) :: z
                                                              real(8), intent (in) :: t
                                                              real(8), intent (in) :: a
                                                              real(8), intent (in) :: b
                                                              real(8), intent (in) :: c
                                                              real(8), intent (in) :: i
                                                              real(8) :: tmp
                                                              if (((x * y) <= (-5d+181)) .or. (.not. ((x * y) <= 5d+141))) then
                                                                  tmp = y * x
                                                              else
                                                                  tmp = i * c
                                                              end if
                                                              code = tmp
                                                          end function
                                                          
                                                          public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                          	double tmp;
                                                          	if (((x * y) <= -5e+181) || !((x * y) <= 5e+141)) {
                                                          		tmp = y * x;
                                                          	} else {
                                                          		tmp = i * c;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          def code(x, y, z, t, a, b, c, i):
                                                          	tmp = 0
                                                          	if ((x * y) <= -5e+181) or not ((x * y) <= 5e+141):
                                                          		tmp = y * x
                                                          	else:
                                                          		tmp = i * c
                                                          	return tmp
                                                          
                                                          function code(x, y, z, t, a, b, c, i)
                                                          	tmp = 0.0
                                                          	if ((Float64(x * y) <= -5e+181) || !(Float64(x * y) <= 5e+141))
                                                          		tmp = Float64(y * x);
                                                          	else
                                                          		tmp = Float64(i * c);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          function tmp_2 = code(x, y, z, t, a, b, c, i)
                                                          	tmp = 0.0;
                                                          	if (((x * y) <= -5e+181) || ~(((x * y) <= 5e+141)))
                                                          		tmp = y * x;
                                                          	else
                                                          		tmp = i * c;
                                                          	end
                                                          	tmp_2 = tmp;
                                                          end
                                                          
                                                          code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+181], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+141]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(i * c), $MachinePrecision]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+181} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+141}\right):\\
                                                          \;\;\;\;y \cdot x\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;i \cdot c\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if (*.f64 x y) < -5.0000000000000003e181 or 5.00000000000000025e141 < (*.f64 x y)

                                                            1. Initial program 93.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-*.f6488.5

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(i, \color{blue}{c}, b \cdot a\right) \]
                                                                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-*.f6470.3

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

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

                                                                if -5.0000000000000003e181 < (*.f64 x y) < 5.00000000000000025e141

                                                                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 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-*.f6436.9

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

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

                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+181} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+141}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
                                                              6. Add Preprocessing

                                                              Alternative 12: 42.8% accurate, 1.1× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+167} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+137}\right):\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \end{array} \]
                                                              (FPCore (x y z t a b c i)
                                                               :precision binary64
                                                               (if (or (<= (* z t) -1e+167) (not (<= (* z t) 2e+137))) (* t z) (* i c)))
                                                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                              	double tmp;
                                                              	if (((z * t) <= -1e+167) || !((z * t) <= 2e+137)) {
                                                              		tmp = t * z;
                                                              	} else {
                                                              		tmp = i * c;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              module fmin_fmax_functions
                                                                  implicit none
                                                                  private
                                                                  public fmax
                                                                  public fmin
                                                              
                                                                  interface fmax
                                                                      module procedure fmax88
                                                                      module procedure fmax44
                                                                      module procedure fmax84
                                                                      module procedure fmax48
                                                                  end interface
                                                                  interface fmin
                                                                      module procedure fmin88
                                                                      module procedure fmin44
                                                                      module procedure fmin84
                                                                      module procedure fmin48
                                                                  end interface
                                                              contains
                                                                  real(8) function fmax88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmax44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmin44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                              end module
                                                              
                                                              real(8) function code(x, y, z, t, a, b, c, i)
                                                              use fmin_fmax_functions
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  real(8), intent (in) :: z
                                                                  real(8), intent (in) :: t
                                                                  real(8), intent (in) :: a
                                                                  real(8), intent (in) :: b
                                                                  real(8), intent (in) :: c
                                                                  real(8), intent (in) :: i
                                                                  real(8) :: tmp
                                                                  if (((z * t) <= (-1d+167)) .or. (.not. ((z * t) <= 2d+137))) then
                                                                      tmp = t * z
                                                                  else
                                                                      tmp = i * c
                                                                  end if
                                                                  code = tmp
                                                              end function
                                                              
                                                              public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                                              	double tmp;
                                                              	if (((z * t) <= -1e+167) || !((z * t) <= 2e+137)) {
                                                              		tmp = t * z;
                                                              	} else {
                                                              		tmp = i * c;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              def code(x, y, z, t, a, b, c, i):
                                                              	tmp = 0
                                                              	if ((z * t) <= -1e+167) or not ((z * t) <= 2e+137):
                                                              		tmp = t * z
                                                              	else:
                                                              		tmp = i * c
                                                              	return tmp
                                                              
                                                              function code(x, y, z, t, a, b, c, i)
                                                              	tmp = 0.0
                                                              	if ((Float64(z * t) <= -1e+167) || !(Float64(z * t) <= 2e+137))
                                                              		tmp = Float64(t * z);
                                                              	else
                                                              		tmp = Float64(i * c);
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              function tmp_2 = code(x, y, z, t, a, b, c, i)
                                                              	tmp = 0.0;
                                                              	if (((z * t) <= -1e+167) || ~(((z * t) <= 2e+137)))
                                                              		tmp = t * z;
                                                              	else
                                                              		tmp = i * c;
                                                              	end
                                                              	tmp_2 = tmp;
                                                              end
                                                              
                                                              code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+167], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+137]], $MachinePrecision]], N[(t * z), $MachinePrecision], N[(i * c), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+167} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+137}\right):\\
                                                              \;\;\;\;t \cdot z\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;i \cdot c\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if (*.f64 z t) < -1e167 or 2.0000000000000001e137 < (*.f64 z t)

                                                                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 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-*.f6435.5

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

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

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

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

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

                                                                      \[\leadsto \color{blue}{t \cdot z} \]
                                                                    3. Step-by-step derivation
                                                                      1. lower-*.f6472.5

                                                                        \[\leadsto \color{blue}{t \cdot z} \]
                                                                    4. Applied rewrites72.5%

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

                                                                    if -1e167 < (*.f64 z t) < 2.0000000000000001e137

                                                                    1. Initial program 97.8%

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

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

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

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

                                                                      \[\leadsto \color{blue}{i \cdot c} \]
                                                                  4. Recombined 2 regimes into one program.
                                                                  5. Final simplification45.3%

                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+167} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+137}\right):\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;i \cdot c\\ \end{array} \]
                                                                  6. Add Preprocessing

                                                                  Alternative 13: 27.4% accurate, 5.0× speedup?

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

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

                                                                    \[\leadsto \color{blue}{i \cdot c} \]
                                                                  6. Add Preprocessing

                                                                  Reproduce

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