Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A

Percentage Accurate: 90.6% → 97.1%
Time: 4.3s
Alternatives: 18
Speedup: 0.7×

Specification

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

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

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 18 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: 90.6% accurate, 1.0× speedup?

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

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

Alternative 1: 97.1% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -3.5999999999999999e-73 or 1.00000000000000005e26 < i

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5999999999999999e-73 < i < 1.00000000000000005e26

    1. Initial program 90.6%

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

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

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

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

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(\left(-1 \cdot b\right) \cdot \left(c \cdot i\right) - a \cdot i, c, t \cdot z + x \cdot y\right) \]
      5. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 94.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \mathsf{fma}\left(i, a, \left(i \cdot c\right) \cdot b\right)\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+257}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right) \cdot i\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \left(c \cdot b + a\right)\right) \]
      11. *-commutativeN/A

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

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot b + a\right) \cdot \color{blue}{i}\right) \]
    6. Applied rewrites46.9%

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(b \cdot c + a\right) \cdot i\right) \]
      3. +-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(a + b \cdot c\right) \cdot i\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \color{blue}{\left(a + b \cdot c\right)}\right) \]
      5. distribute-rgt-inN/A

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot a + \color{blue}{\left(b \cdot c\right)} \cdot i\right) \]
      7. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \mathsf{fma}\left(i, a, \left(c \cdot i\right) \cdot b\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \mathsf{fma}\left(i, a, \left(c \cdot i\right) \cdot b\right) \]
      11. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \mathsf{fma}\left(i, a, \left(i \cdot c\right) \cdot b\right) \]
      12. lift-*.f6445.6

        \[\leadsto \left(-2 \cdot c\right) \cdot \mathsf{fma}\left(i, a, \left(i \cdot c\right) \cdot b\right) \]
    8. Applied rewrites45.6%

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

    if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 5.00000000000000028e257

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000028e257 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      7. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      8. +-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      10. lower-fma.f6469.3

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.3%

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

Alternative 3: 83.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-18}:\\
\;\;\;\;2 \cdot \left(t \cdot z - t\_1 \cdot c\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.9999999999999994e104

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(c \cdot b + a\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

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

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

        \[\leadsto 2 \cdot \left(x \cdot y - \color{blue}{\left(\left(c \cdot b + a\right) \cdot c\right) \cdot i}\right) \]
    6. Applied rewrites69.4%

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

      \[\leadsto 2 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot \left(-1 \cdot y + \frac{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}{x}\right)\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto 2 \cdot \left(\left(-1 \cdot x\right) \cdot \left(-1 \cdot y + \color{blue}{\frac{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}{x}}\right)\right) \]
      3. mul-1-negN/A

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

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \left(-1 \cdot y + \frac{\color{blue}{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}}{x}\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \left(\frac{c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)}{x} + -1 \cdot \color{blue}{y}\right)\right) \]
      6. associate-/l*N/A

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

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

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

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\left(b \cdot c + a\right) \cdot i}{x}, -1 \cdot y\right)\right) \]
      10. lower-/.f64N/A

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

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

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\left(c \cdot b + a\right) \cdot i}{x}, -1 \cdot y\right)\right) \]
      13. lower-fma.f64N/A

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\mathsf{fma}\left(c, b, a\right) \cdot i}{x}, -1 \cdot y\right)\right) \]
      14. mul-1-negN/A

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\mathsf{fma}\left(c, b, a\right) \cdot i}{x}, \mathsf{neg}\left(y\right)\right)\right) \]
      15. lower-neg.f6465.6

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{\mathsf{fma}\left(c, b, a\right) \cdot i}{x}, -y\right)\right) \]
    9. Applied rewrites65.6%

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

    if -9.9999999999999994e104 < (*.f64 x y) < 2.0000000000000001e-18

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if 2.0000000000000001e-18 < (*.f64 x y)

    1. Initial program 90.6%

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

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

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

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

        \[\leadsto \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      8. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      9. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      10. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      11. lower-*.f6476.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    4. Applied rewrites76.3%

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

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

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      3. associate-*l*N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(c \cdot i\right)\right) \cdot b\right) \cdot 2 \]
      4. lower-*.f64N/A

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

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot 2 \]
      6. lower-*.f6479.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot 2 \]
    6. Applied rewrites79.3%

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

Alternative 4: 83.4% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x - t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.00000000000000004e48

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if -1.00000000000000004e48 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.0000000000000001e137

    1. Initial program 90.6%

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

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

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

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

        \[\leadsto \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      8. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      9. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      10. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      11. lower-*.f6476.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    4. Applied rewrites76.3%

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

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

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      3. associate-*l*N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(c \cdot i\right)\right) \cdot b\right) \cdot 2 \]
      4. lower-*.f64N/A

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

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot 2 \]
      6. lower-*.f6479.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot 2 \]
    6. Applied rewrites79.3%

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

    if 2.0000000000000001e137 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      7. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      8. +-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      10. lower-fma.f6469.3

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.3%

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

Alternative 5: 81.6% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+137}:\\
\;\;\;\;2 \cdot \left(t \cdot z - t\_2 \cdot i\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot x - t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.00000000000000004e48

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if -1.00000000000000004e48 < (*.f64 (+.f64 a (*.f64 b c)) c) < 9.99999999999999995e-56

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

    if 9.99999999999999995e-56 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.0000000000000001e137

    1. Initial program 90.6%

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

      \[\leadsto 2 \cdot \left(\color{blue}{t \cdot z} - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    3. Step-by-step derivation
      1. lower-*.f6468.8

        \[\leadsto 2 \cdot \left(t \cdot \color{blue}{z} - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    4. Applied rewrites68.8%

      \[\leadsto 2 \cdot \left(\color{blue}{t \cdot z} - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]

    if 2.0000000000000001e137 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      7. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      8. +-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      10. lower-fma.f6469.3

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.3%

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

Alternative 6: 81.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\\
t_2 := 2 \cdot \left(y \cdot x - t\_1\right)\\
\mathbf{if}\;x \cdot y \leq -2:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 50000000000000:\\
\;\;\;\;2 \cdot \left(t \cdot z - t\_1\right)\\

\mathbf{elif}\;x \cdot y \leq 10^{+225}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2 or 5e13 < (*.f64 x y) < 9.99999999999999928e224

    1. Initial program 90.6%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      7. lower-*.f64N/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      8. +-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      9. *-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      10. lower-fma.f6469.3

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.3%

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

    if -2 < (*.f64 x y) < 5e13

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if 9.99999999999999928e224 < (*.f64 x y)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

Alternative 7: 80.0% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;x \cdot y \leq 10^{+225}:\\
\;\;\;\;\left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2\\

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


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

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(c \cdot b + a\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

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

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

        \[\leadsto 2 \cdot \left(x \cdot y - \color{blue}{\left(\left(c \cdot b + a\right) \cdot c\right) \cdot i}\right) \]
    6. Applied rewrites69.4%

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

    if -2 < (*.f64 x y) < 5e13

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if 5e13 < (*.f64 x y) < 9.99999999999999928e224

    1. Initial program 90.6%

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

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

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

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

        \[\leadsto \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      8. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      9. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      10. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      11. lower-*.f6476.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    4. Applied rewrites76.3%

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

      \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      2. lower-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      3. pow2N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      5. lift-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      6. *-commutativeN/A

        \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      7. lift-*.f6455.1

        \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    7. Applied rewrites55.1%

      \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]

    if 9.99999999999999928e224 < (*.f64 x y)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

Alternative 8: 78.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+113}:\\
\;\;\;\;2 \cdot \left(x \cdot y - \left(\left(c \cdot b\right) \cdot c\right) \cdot i\right)\\

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

\mathbf{elif}\;x \cdot y \leq 10^{+225}:\\
\;\;\;\;\left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2\\

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


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

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. +-commutativeN/A

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

        \[\leadsto 2 \cdot \left(x \cdot y - c \cdot \left(i \cdot \left(c \cdot b + a\right)\right)\right) \]
      10. *-commutativeN/A

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

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

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

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

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

        \[\leadsto 2 \cdot \left(x \cdot y - \color{blue}{\left(\left(c \cdot b + a\right) \cdot c\right) \cdot i}\right) \]
    6. Applied rewrites69.4%

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

      \[\leadsto 2 \cdot \left(x \cdot y - \left(\left(b \cdot c\right) \cdot c\right) \cdot i\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 2 \cdot \left(x \cdot y - \left(\left(c \cdot b\right) \cdot c\right) \cdot i\right) \]
      2. lower-*.f6455.3

        \[\leadsto 2 \cdot \left(x \cdot y - \left(\left(c \cdot b\right) \cdot c\right) \cdot i\right) \]
    9. Applied rewrites55.3%

      \[\leadsto 2 \cdot \left(x \cdot y - \left(\left(c \cdot b\right) \cdot c\right) \cdot i\right) \]

    if -5e113 < (*.f64 x y) < 5e13

    1. Initial program 90.6%

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. lower-*.f64N/A

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

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      8. *-commutativeN/A

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      9. lower-fma.f6469.0

        \[\leadsto 2 \cdot \left(t \cdot z - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites69.0%

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

    if 5e13 < (*.f64 x y) < 9.99999999999999928e224

    1. Initial program 90.6%

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

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

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

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

        \[\leadsto \left(\left(t \cdot z + x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      4. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, x \cdot y\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      8. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      9. lower-*.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left({c}^{2} \cdot i\right) \cdot b\right) \cdot 2 \]
      10. unpow2N/A

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      11. lower-*.f6476.3

        \[\leadsto \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    4. Applied rewrites76.3%

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

      \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
    6. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      2. lower-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left({c}^{2} \cdot i\right)\right) \cdot 2 \]
      3. pow2N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      4. lift-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      5. lift-*.f64N/A

        \[\leadsto \left(x \cdot y - b \cdot \left(\left(c \cdot c\right) \cdot i\right)\right) \cdot 2 \]
      6. *-commutativeN/A

        \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
      7. lift-*.f6455.1

        \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]
    7. Applied rewrites55.1%

      \[\leadsto \left(x \cdot y - \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot 2 \]

    if 9.99999999999999928e224 < (*.f64 x y)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

Alternative 9: 76.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := -2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.00000000000000004e48 or 1.00000000000000001e160 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

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

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

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

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

        \[\leadsto -2 \cdot \left(\left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      5. lower-*.f64N/A

        \[\leadsto -2 \cdot \left(\left(\left(a + b \cdot c\right) \cdot i\right) \cdot c\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(\left(\left(b \cdot c + a\right) \cdot i\right) \cdot c\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(\left(\left(c \cdot b + a\right) \cdot i\right) \cdot c\right) \]
      8. lower-fma.f6446.9

        \[\leadsto -2 \cdot \left(\left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites46.9%

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

    if -1.00000000000000004e48 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.00000000000000001e160

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

Alternative 10: 71.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+230}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.0000000000000001e230

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \left(c \cdot b + a\right)\right) \]
      11. *-commutativeN/A

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

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot b + a\right) \cdot \color{blue}{i}\right) \]
    6. Applied rewrites46.9%

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

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(b \cdot \color{blue}{\left(c \cdot i\right)}\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
      4. lift-*.f6433.3

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
    9. Applied rewrites33.3%

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot \color{blue}{b}\right) \]

    if -1.0000000000000001e230 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.00000000000000001e160

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

    if 1.00000000000000001e160 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999999e294

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]

    if 4.9999999999999999e294 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      6. unpow2N/A

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
      7. lower-*.f6432.4

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
    4. Applied rewrites32.4%

      \[\leadsto \color{blue}{\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 11: 70.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+230}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\

\mathbf{else}:\\
\;\;\;\;\left(\left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.0000000000000001e230

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \left(c \cdot b + a\right)\right) \]
      11. *-commutativeN/A

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

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot b + a\right) \cdot \color{blue}{i}\right) \]
    6. Applied rewrites46.9%

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

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(b \cdot \color{blue}{\left(c \cdot i\right)}\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
      4. lift-*.f6433.3

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
    9. Applied rewrites33.3%

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot \color{blue}{b}\right) \]

    if -1.0000000000000001e230 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.00000000000000001e160

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

    if 1.00000000000000001e160 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.9999999999999999e294

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]

    if 4.9999999999999999e294 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(b \cdot \left({c}^{2} \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(b \cdot \left({c}^{2} \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left({c}^{2} \cdot i\right) \cdot b\right) \cdot -2 \]
      6. unpow2N/A

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
      7. lower-*.f6432.4

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
    4. Applied rewrites32.4%

      \[\leadsto \color{blue}{\left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2 \]
      3. associate-*l*N/A

        \[\leadsto \left(\left(c \cdot \left(c \cdot i\right)\right) \cdot b\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot \left(c \cdot i\right)\right) \cdot b\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot -2 \]
      6. lift-*.f6433.4

        \[\leadsto \left(\left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot -2 \]
    6. Applied rewrites33.4%

      \[\leadsto \left(\left(c \cdot \left(i \cdot c\right)\right) \cdot b\right) \cdot -2 \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 12: 70.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right)\\
t_2 := \left(a + b \cdot c\right) \cdot c\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+230}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (+.f64 a (*.f64 b c)) c) < -1.0000000000000001e230 or 1.9999999999999999e298 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \left(c \cdot b + a\right)\right) \]
      11. *-commutativeN/A

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

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot b + a\right) \cdot \color{blue}{i}\right) \]
    6. Applied rewrites46.9%

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

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(b \cdot \color{blue}{\left(c \cdot i\right)}\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot b\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
      4. lift-*.f6433.3

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot b\right) \]
    9. Applied rewrites33.3%

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(i \cdot c\right) \cdot \color{blue}{b}\right) \]

    if -1.0000000000000001e230 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.00000000000000001e160

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

    if 1.00000000000000001e160 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.9999999999999999e298

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 62.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+255}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e255 or 4.9999999999999997e253 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]

    if -5.0000000000000002e255 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999997e253

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

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

        \[\leadsto \mathsf{fma}\left(t, z, x \cdot y\right) \cdot 2 \]
      3. lower-fma.f64N/A

        \[\leadsto \left(t \cdot z + x \cdot y\right) \cdot 2 \]
      4. +-commutativeN/A

        \[\leadsto \left(x \cdot y + t \cdot z\right) \cdot 2 \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot x + t \cdot z\right) \cdot 2 \]
      6. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
      8. lower-*.f6455.6

        \[\leadsto \mathsf{fma}\left(y, x, z \cdot t\right) \cdot 2 \]
    6. Applied rewrites55.6%

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

Alternative 14: 62.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+255}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e255 or 4.9999999999999997e253 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]

    if -5.0000000000000002e255 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.9999999999999997e253

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t, z, y \cdot x\right) \cdot 2 \]
    4. Applied rewrites55.7%

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

Alternative 15: 45.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\ t_2 := \left(t + t\right) \cdot z\\ \mathbf{if}\;z \cdot t \leq -500000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-172}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10^{-251}:\\ \;\;\;\;\left(x + x\right) \cdot y\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+224}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* (* (* i c) a) -2.0)) (t_2 (* (+ t t) z)))
   (if (<= (* z t) -500000.0)
     t_2
     (if (<= (* z t) -5e-172)
       t_1
       (if (<= (* z t) 1e-251)
         (* (+ x x) y)
         (if (<= (* z t) 4e+224) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = ((i * c) * a) * -2.0;
	double t_2 = (t + t) * z;
	double tmp;
	if ((z * t) <= -500000.0) {
		tmp = t_2;
	} else if ((z * t) <= -5e-172) {
		tmp = t_1;
	} else if ((z * t) <= 1e-251) {
		tmp = (x + x) * y;
	} else if ((z * t) <= 4e+224) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ((i * c) * a) * (-2.0d0)
    t_2 = (t + t) * z
    if ((z * t) <= (-500000.0d0)) then
        tmp = t_2
    else if ((z * t) <= (-5d-172)) then
        tmp = t_1
    else if ((z * t) <= 1d-251) then
        tmp = (x + x) * y
    else if ((z * t) <= 4d+224) then
        tmp = t_1
    else
        tmp = t_2
    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 t_1 = ((i * c) * a) * -2.0;
	double t_2 = (t + t) * z;
	double tmp;
	if ((z * t) <= -500000.0) {
		tmp = t_2;
	} else if ((z * t) <= -5e-172) {
		tmp = t_1;
	} else if ((z * t) <= 1e-251) {
		tmp = (x + x) * y;
	} else if ((z * t) <= 4e+224) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = ((i * c) * a) * -2.0
	t_2 = (t + t) * z
	tmp = 0
	if (z * t) <= -500000.0:
		tmp = t_2
	elif (z * t) <= -5e-172:
		tmp = t_1
	elif (z * t) <= 1e-251:
		tmp = (x + x) * y
	elif (z * t) <= 4e+224:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(Float64(i * c) * a) * -2.0)
	t_2 = Float64(Float64(t + t) * z)
	tmp = 0.0
	if (Float64(z * t) <= -500000.0)
		tmp = t_2;
	elseif (Float64(z * t) <= -5e-172)
		tmp = t_1;
	elseif (Float64(z * t) <= 1e-251)
		tmp = Float64(Float64(x + x) * y);
	elseif (Float64(z * t) <= 4e+224)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = ((i * c) * a) * -2.0;
	t_2 = (t + t) * z;
	tmp = 0.0;
	if ((z * t) <= -500000.0)
		tmp = t_2;
	elseif ((z * t) <= -5e-172)
		tmp = t_1;
	elseif ((z * t) <= 1e-251)
		tmp = (x + x) * y;
	elseif ((z * t) <= 4e+224)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -500000.0], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -5e-172], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e-251], N[(N[(x + x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+224], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\left(i \cdot c\right) \cdot a\right) \cdot -2\\
t_2 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -500000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10^{-251}:\\
\;\;\;\;\left(x + x\right) \cdot y\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+224}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -5e5 or 3.99999999999999988e224 < (*.f64 z t)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot t\right) \cdot \color{blue}{z} \]
      3. count-2-revN/A

        \[\leadsto \left(t + t\right) \cdot z \]
      4. lower-+.f6429.0

        \[\leadsto \left(t + t\right) \cdot z \]
    4. Applied rewrites29.0%

      \[\leadsto \color{blue}{\left(t + t\right) \cdot z} \]

    if -5e5 < (*.f64 z t) < -4.9999999999999999e-172 or 1.00000000000000002e-251 < (*.f64 z t) < 3.99999999999999988e224

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(c \cdot i\right)\right) \cdot \color{blue}{-2} \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(c \cdot i\right) \cdot a\right) \cdot -2 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
      6. lower-*.f6425.3

        \[\leadsto \left(\left(i \cdot c\right) \cdot a\right) \cdot -2 \]
    4. Applied rewrites25.3%

      \[\leadsto \color{blue}{\left(\left(i \cdot c\right) \cdot a\right) \cdot -2} \]

    if -4.9999999999999999e-172 < (*.f64 z t) < 1.00000000000000002e-251

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot x\right) \cdot \color{blue}{y} \]
      3. count-2-revN/A

        \[\leadsto \left(x + x\right) \cdot y \]
      4. lower-+.f6429.8

        \[\leadsto \left(x + x\right) \cdot y \]
    4. Applied rewrites29.8%

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

Alternative 16: 40.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t + t\right) \cdot z\\ \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+143}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10^{-251}:\\ \;\;\;\;\left(x + x\right) \cdot y\\ \mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+224}:\\ \;\;\;\;\left(-2 \cdot c\right) \cdot \left(i \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* (+ t t) z)))
   (if (<= (* z t) -5e+143)
     t_1
     (if (<= (* z t) 1e-251)
       (* (+ x x) y)
       (if (<= (* z t) 4e+224) (* (* -2.0 c) (* i a)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (t + t) * z;
	double tmp;
	if ((z * t) <= -5e+143) {
		tmp = t_1;
	} else if ((z * t) <= 1e-251) {
		tmp = (x + x) * y;
	} else if ((z * t) <= 4e+224) {
		tmp = (-2.0 * c) * (i * a);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (t + t) * z
    if ((z * t) <= (-5d+143)) then
        tmp = t_1
    else if ((z * t) <= 1d-251) then
        tmp = (x + x) * y
    else if ((z * t) <= 4d+224) then
        tmp = ((-2.0d0) * c) * (i * a)
    else
        tmp = t_1
    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 t_1 = (t + t) * z;
	double tmp;
	if ((z * t) <= -5e+143) {
		tmp = t_1;
	} else if ((z * t) <= 1e-251) {
		tmp = (x + x) * y;
	} else if ((z * t) <= 4e+224) {
		tmp = (-2.0 * c) * (i * a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (t + t) * z
	tmp = 0
	if (z * t) <= -5e+143:
		tmp = t_1
	elif (z * t) <= 1e-251:
		tmp = (x + x) * y
	elif (z * t) <= 4e+224:
		tmp = (-2.0 * c) * (i * a)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(t + t) * z)
	tmp = 0.0
	if (Float64(z * t) <= -5e+143)
		tmp = t_1;
	elseif (Float64(z * t) <= 1e-251)
		tmp = Float64(Float64(x + x) * y);
	elseif (Float64(z * t) <= 4e+224)
		tmp = Float64(Float64(-2.0 * c) * Float64(i * a));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (t + t) * z;
	tmp = 0.0;
	if ((z * t) <= -5e+143)
		tmp = t_1;
	elseif ((z * t) <= 1e-251)
		tmp = (x + x) * y;
	elseif ((z * t) <= 4e+224)
		tmp = (-2.0 * c) * (i * a);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+143], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e-251], N[(N[(x + x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+224], N[(N[(-2.0 * c), $MachinePrecision] * N[(i * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(t + t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10^{-251}:\\
\;\;\;\;\left(x + x\right) \cdot y\\

\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+224}:\\
\;\;\;\;\left(-2 \cdot c\right) \cdot \left(i \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -5.00000000000000012e143 or 3.99999999999999988e224 < (*.f64 z t)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot t\right) \cdot \color{blue}{z} \]
      3. count-2-revN/A

        \[\leadsto \left(t + t\right) \cdot z \]
      4. lower-+.f6429.0

        \[\leadsto \left(t + t\right) \cdot z \]
    4. Applied rewrites29.0%

      \[\leadsto \color{blue}{\left(t + t\right) \cdot z} \]

    if -5.00000000000000012e143 < (*.f64 z t) < 1.00000000000000002e-251

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot x\right) \cdot \color{blue}{y} \]
      3. count-2-revN/A

        \[\leadsto \left(x + x\right) \cdot y \]
      4. lower-+.f6429.8

        \[\leadsto \left(x + x\right) \cdot y \]
    4. Applied rewrites29.8%

      \[\leadsto \color{blue}{\left(x + x\right) \cdot y} \]

    if 1.00000000000000002e-251 < (*.f64 z t) < 3.99999999999999988e224

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-+r-N/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -2 \cdot \left(c \cdot \left(i \cdot \left(a + b \cdot c\right)\right)\right) \]
      8. associate-*r*N/A

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \left(c \cdot b + a\right)\right) \]
      11. *-commutativeN/A

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

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

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

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(\left(c \cdot b + a\right) \cdot \color{blue}{i}\right) \]
    6. Applied rewrites46.9%

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

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(a \cdot \color{blue}{i}\right) \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot a\right) \]
      2. lower-*.f6422.2

        \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot a\right) \]
    9. Applied rewrites22.2%

      \[\leadsto \left(-2 \cdot c\right) \cdot \left(i \cdot \color{blue}{a}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 40.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x + x\right) \cdot y\\ \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+105}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 50000000000000:\\ \;\;\;\;\left(t + t\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* (+ x x) y)))
   (if (<= (* x y) -1e+105)
     t_1
     (if (<= (* x y) 50000000000000.0) (* (+ t 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 = (x + x) * y;
	double tmp;
	if ((x * y) <= -1e+105) {
		tmp = t_1;
	} else if ((x * y) <= 50000000000000.0) {
		tmp = (t + t) * z;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (x + x) * y
    if ((x * y) <= (-1d+105)) then
        tmp = t_1
    else if ((x * y) <= 50000000000000.0d0) then
        tmp = (t + t) * z
    else
        tmp = t_1
    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 t_1 = (x + x) * y;
	double tmp;
	if ((x * y) <= -1e+105) {
		tmp = t_1;
	} else if ((x * y) <= 50000000000000.0) {
		tmp = (t + t) * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (x + x) * y
	tmp = 0
	if (x * y) <= -1e+105:
		tmp = t_1
	elif (x * y) <= 50000000000000.0:
		tmp = (t + t) * z
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(x + x) * y)
	tmp = 0.0
	if (Float64(x * y) <= -1e+105)
		tmp = t_1;
	elseif (Float64(x * y) <= 50000000000000.0)
		tmp = Float64(Float64(t + t) * z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (x + x) * y;
	tmp = 0.0;
	if ((x * y) <= -1e+105)
		tmp = t_1;
	elseif ((x * y) <= 50000000000000.0)
		tmp = (t + t) * z;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x + x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+105], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 50000000000000.0], N[(N[(t + t), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x + x\right) \cdot y\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 50000000000000:\\
\;\;\;\;\left(t + t\right) \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -9.9999999999999994e104 or 5e13 < (*.f64 x y)

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot x\right) \cdot \color{blue}{y} \]
      3. count-2-revN/A

        \[\leadsto \left(x + x\right) \cdot y \]
      4. lower-+.f6429.8

        \[\leadsto \left(x + x\right) \cdot y \]
    4. Applied rewrites29.8%

      \[\leadsto \color{blue}{\left(x + x\right) \cdot y} \]

    if -9.9999999999999994e104 < (*.f64 x y) < 5e13

    1. Initial program 90.6%

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

      \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot t\right) \cdot \color{blue}{z} \]
      3. count-2-revN/A

        \[\leadsto \left(t + t\right) \cdot z \]
      4. lower-+.f6429.0

        \[\leadsto \left(t + t\right) \cdot z \]
    4. Applied rewrites29.0%

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

Alternative 18: 29.0% accurate, 4.0× speedup?

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

\\
\left(t + t\right) \cdot z
\end{array}
Derivation
  1. Initial program 90.6%

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

    \[\leadsto \color{blue}{2 \cdot \left(t \cdot z\right)} \]
  3. Step-by-step derivation
    1. associate-*r*N/A

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

      \[\leadsto \left(2 \cdot t\right) \cdot \color{blue}{z} \]
    3. count-2-revN/A

      \[\leadsto \left(t + t\right) \cdot z \]
    4. lower-+.f6429.0

      \[\leadsto \left(t + t\right) \cdot z \]
  4. Applied rewrites29.0%

    \[\leadsto \color{blue}{\left(t + t\right) \cdot z} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2025142 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64
  (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))