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

Percentage Accurate: 95.9% → 97.9%
Time: 4.7s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 95.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i):
	return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (((x * y) + (z * t)) + (a * b)) + (c * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.9% accurate, 1.3× speedup?

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

\\
\mathsf{fma}\left(y, x, \mathsf{fma}\left(t, z, \mathsf{fma}\left(i, c, b \cdot a\right)\right)\right)
\end{array}
Derivation
  1. Initial program 97.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.1% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-319}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq 10^{+113}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -3.99999999999999984e88

    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. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.99999999999999984e88 < (*.f64 x y) < 4.9999937e-319 or 1.00000000000000003e40 < (*.f64 x y) < 1e113

      1. Initial program 96.7%

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

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

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

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

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

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

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

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

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

        if 4.9999937e-319 < (*.f64 x y) < 1.00000000000000003e40

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right) \]
          5. Step-by-step derivation
            1. Applied rewrites74.0%

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

            if 1e113 < (*.f64 x y)

            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. Step-by-step derivation
              1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 3: 62.8% accurate, 0.5× speedup?

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

              1. Initial program 96.7%

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

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

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

                if -1.9999999999999999e159 < (*.f64 x y) < 4.9999937e-319 or 1.00000000000000003e40 < (*.f64 x y) < 9.9999999999999998e184

                1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

                  if 4.9999937e-319 < (*.f64 x y) < 1.00000000000000003e40

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right) \]
                    5. Step-by-step derivation
                      1. Applied rewrites74.0%

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

                    Alternative 4: 75.8% accurate, 0.6× speedup?

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

                      1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        if -5.0000000000000001e142 < (+.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999998e184

                        1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

                        Alternative 5: 66.3% accurate, 0.7× speedup?

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

                          1. Initial program 97.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if -3.99999999999999984e88 < (*.f64 x y) < 4.9999937e-319

                            1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

                              if 4.9999937e-319 < (*.f64 x y) < 1.9999999999999999e87

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(i, c, \color{blue}{t \cdot z}\right) \]
                                5. Step-by-step derivation
                                  1. Applied rewrites74.1%

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

                                Alternative 6: 86.1% accurate, 0.7× speedup?

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

                                  1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

                                    if -5e128 < (*.f64 a b) < 4.9999999999999996e180

                                    1. Initial program 99.4%

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

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

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

                                      if 4.9999999999999996e180 < (*.f64 a b)

                                      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. Step-by-step derivation
                                        1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      Alternative 7: 63.3% accurate, 0.9× speedup?

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

                                        1. Initial program 96.7%

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

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

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

                                          if -1.9999999999999999e159 < (*.f64 x y) < 9.9999999999999998e184

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

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

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

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

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

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

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

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

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

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

                                          Alternative 8: 43.7% accurate, 1.1× speedup?

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

                                            1. Initial program 96.4%

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

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

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

                                              if -2.0000000000000001e47 < (*.f64 c i) < 1.00000000000000009e56

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

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

                                                  \[\leadsto \color{blue}{b \cdot a} \]
                                              5. Recombined 2 regimes into one program.
                                              6. Final simplification52.5%

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

                                              Alternative 9: 27.4% accurate, 5.0× speedup?

                                              \[\begin{array}{l} \\ b \cdot a \end{array} \]
                                              (FPCore (x y z t a b c i) :precision binary64 (* b a))
                                              double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                              	return b * a;
                                              }
                                              
                                              module fmin_fmax_functions
                                                  implicit none
                                                  private
                                                  public fmax
                                                  public fmin
                                              
                                                  interface fmax
                                                      module procedure fmax88
                                                      module procedure fmax44
                                                      module procedure fmax84
                                                      module procedure fmax48
                                                  end interface
                                                  interface fmin
                                                      module procedure fmin88
                                                      module procedure fmin44
                                                      module procedure fmin84
                                                      module procedure fmin48
                                                  end interface
                                              contains
                                                  real(8) function fmax88(x, y) result (res)
                                                      real(8), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                  end function
                                                  real(4) function fmax44(x, y) result (res)
                                                      real(4), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmax84(x, y) result(res)
                                                      real(8), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmax48(x, y) result(res)
                                                      real(4), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin88(x, y) result (res)
                                                      real(8), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                  end function
                                                  real(4) function fmin44(x, y) result (res)
                                                      real(4), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin84(x, y) result(res)
                                                      real(8), intent (in) :: x
                                                      real(4), intent (in) :: y
                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                  end function
                                                  real(8) function fmin48(x, y) result(res)
                                                      real(4), intent (in) :: x
                                                      real(8), intent (in) :: y
                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                  end function
                                              end module
                                              
                                              real(8) function code(x, y, z, t, a, b, c, i)
                                              use fmin_fmax_functions
                                                  real(8), intent (in) :: x
                                                  real(8), intent (in) :: y
                                                  real(8), intent (in) :: z
                                                  real(8), intent (in) :: t
                                                  real(8), intent (in) :: a
                                                  real(8), intent (in) :: b
                                                  real(8), intent (in) :: c
                                                  real(8), intent (in) :: i
                                                  code = b * a
                                              end function
                                              
                                              public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
                                              	return b * a;
                                              }
                                              
                                              def code(x, y, z, t, a, b, c, i):
                                              	return b * a
                                              
                                              function code(x, y, z, t, a, b, c, i)
                                              	return Float64(b * a)
                                              end
                                              
                                              function tmp = code(x, y, z, t, a, b, c, i)
                                              	tmp = b * a;
                                              end
                                              
                                              code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(b * a), $MachinePrecision]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              b \cdot a
                                              \end{array}
                                              
                                              Derivation
                                              1. Initial program 97.6%

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

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

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

                                                Reproduce

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