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

Percentage Accurate: 90.4% → 97.3%
Time: 4.5s
Alternatives: 13
Speedup: 0.8×

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

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

Initial Program: 90.4% 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.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 94.8%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

    if +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)))

    1. Initial program 0.0%

      \[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.f6437.7

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

      \[\leadsto 2 \cdot \color{blue}{\left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)} \]
    5. 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) \]
    6. 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{i \cdot \left(a + c \cdot b\right)}{x}, -1 \cdot y\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto 2 \cdot \left(\left(-x\right) \cdot \mathsf{fma}\left(c, \frac{i \cdot \left(c \cdot b + a\right)}{x}, -1 \cdot y\right)\right) \]
      10. *-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) \]
      11. lower-/.f64N/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) \]
      12. lower-*.f64N/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. *-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) \]
      14. lower-fma.f64N/A

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

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

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

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

Alternative 2: 96.1% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 94.8%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

    if +inf.0 < (*.f64 #s(literal 2 binary64) (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)))

    1. Initial program 0.0%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.5% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 75.1%

      \[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.f6488.3

        \[\leadsto 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right) \]
    4. Applied rewrites88.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.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2e13

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

    if 2e13 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 85.3%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 88.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(y \cdot x - \left(\mathsf{fma}\left(c, b, a\right) \cdot i\right) \cdot c\right)\\ t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+299}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \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 (* 2.0 (- (* y x) (* (* (fma c b a) i) c))))
        (t_2 (* (* (+ a (* b c)) c) i)))
   (if (<= t_2 -2e+299)
     t_1
     (if (<= t_2 2e+260) (* 2.0 (- (fma t z (* y x)) (* (* i c) a))) 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 * ((y * x) - ((fma(c, b, a) * i) * c));
	double t_2 = ((a + (b * c)) * c) * i;
	double tmp;
	if (t_2 <= -2e+299) {
		tmp = t_1;
	} else if (t_2 <= 2e+260) {
		tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(Float64(y * x) - Float64(Float64(fma(c, b, a) * i) * c)))
	t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i)
	tmp = 0.0
	if (t_2 <= -2e+299)
		tmp = t_1;
	elseif (t_2 <= 2e+260)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a)));
	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[(y * x), $MachinePrecision] - N[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+299], t$95$1, If[LessEqual[t$95$2, 2e+260], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\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) < -2.0000000000000001e299 or 2.00000000000000013e260 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.5%

      \[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.f6486.5

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

      \[\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.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000013e260

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 82.8% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 82.2%

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

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

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

    if -1e86 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138

    1. Initial program 99.0%

      \[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(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right) \]
      3. lower-*.f6485.9

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

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

    if 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.8%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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(\color{blue}{\mathsf{fma}\left(b, c, a\right)} \cdot i\right) \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 81.3% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 75.1%

      \[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.f6488.5

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

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

    if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138

    1. Initial program 99.1%

      \[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(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

    if 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 81.8%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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(\color{blue}{\mathsf{fma}\left(b, c, a\right)} \cdot i\right) \]
      2. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.3% accurate, 0.6× 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(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+299}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+138}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\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 c b a) i) c))) (t_2 (* (* (+ a (* b c)) c) i)))
   (if (<= t_2 -2e+299)
     t_1
     (if (<= t_2 5e+138) (* 2.0 (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(c, b, a) * i) * c);
	double t_2 = ((a + (b * c)) * c) * i;
	double tmp;
	if (t_2 <= -2e+299) {
		tmp = t_1;
	} else if (t_2 <= 5e+138) {
		tmp = 2.0 * 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 * Float64(Float64(fma(c, b, a) * i) * c))
	t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i)
	tmp = 0.0
	if (t_2 <= -2e+299)
		tmp = t_1;
	elseif (t_2 <= 5e+138)
		tmp = Float64(2.0 * 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[(N[(N[(c * b + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+299], t$95$1, If[LessEqual[t$95$2, 5e+138], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $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(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+299}:\\
\;\;\;\;t\_1\\

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

\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) < -2.0000000000000001e299 or 5.00000000000000016e138 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 79.0%

      \[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.f6482.6

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

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

    if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000016e138

    1. Initial program 99.1%

      \[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(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 8: 73.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\left(\left(c \cdot c\right) \cdot i\right) \cdot b\right) \cdot -2\\ t_2 := \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+299}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+279}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* (* (* (* c c) i) b) -2.0)) (t_2 (* (* (+ a (* b c)) c) i)))
   (if (<= t_2 -2e+299)
     t_1
     (if (<= t_2 5e+279) (* 2.0 (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 = (((c * c) * i) * b) * -2.0;
	double t_2 = ((a + (b * c)) * c) * i;
	double tmp;
	if (t_2 <= -2e+299) {
		tmp = t_1;
	} else if (t_2 <= 5e+279) {
		tmp = 2.0 * fma(t, z, (y * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(Float64(Float64(c * c) * i) * b) * -2.0)
	t_2 = Float64(Float64(Float64(a + Float64(b * c)) * c) * i)
	tmp = 0.0
	if (t_2 <= -2e+299)
		tmp = t_1;
	elseif (t_2 <= 5e+279)
		tmp = Float64(2.0 * 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[(N[(N[(N[(c * c), $MachinePrecision] * i), $MachinePrecision] * b), $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, -2e+299], t$95$1, If[LessEqual[t$95$2, 5e+279], N[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\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) < -2.0000000000000001e299 or 5.0000000000000002e279 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 76.1%

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

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

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

    if -2.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.0000000000000002e279

    1. Initial program 99.1%

      \[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(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

Alternative 9: 57.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \mathsf{fma}\left(t, z, y \cdot x\right)\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{-22}:\\ \;\;\;\;\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 (fma t z (* y x)))) (t_2 (+ (* x y) (* z t))))
   (if (<= t_2 -5e+48) t_1 (if (<= t_2 1e-22) (* (* (* 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 * fma(t, z, (y * x));
	double t_2 = (x * y) + (z * t);
	double tmp;
	if (t_2 <= -5e+48) {
		tmp = t_1;
	} else if (t_2 <= 1e-22) {
		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(2.0 * fma(t, z, Float64(y * x)))
	t_2 = Float64(Float64(x * y) + Float64(z * t))
	tmp = 0.0
	if (t_2 <= -5e+48)
		tmp = t_1;
	elseif (t_2 <= 1e-22)
		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[(2.0 * N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+48], t$95$1, If[LessEqual[t$95$2, 1e-22], N[(N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision] * -2.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.99999999999999973e48 or 1e-22 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 89.2%

      \[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(t \cdot z + x \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

    if -4.99999999999999973e48 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1e-22

    1. Initial program 93.7%

      \[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-*.f6437.0

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

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

Alternative 10: 94.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(-c, \mathsf{fma}\left(b, c, a\right) \cdot i, y \cdot x\right)\right)\\ \mathbf{if}\;c \leq -8.6 \cdot 10^{-106}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq 10^{-183}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - \left(i \cdot c\right) \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 (* 2.0 (fma z t (fma (- c) (* (fma b c a) i) (* y x))))))
   (if (<= c -8.6e-106)
     t_1
     (if (<= c 1e-183) (* 2.0 (- (fma t z (* y x)) (* (* i c) a))) 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(z, t, fma(-c, (fma(b, c, a) * i), (y * x)));
	double tmp;
	if (c <= -8.6e-106) {
		tmp = t_1;
	} else if (c <= 1e-183) {
		tmp = 2.0 * (fma(t, z, (y * x)) - ((i * c) * a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * fma(z, t, fma(Float64(-c), Float64(fma(b, c, a) * i), Float64(y * x))))
	tmp = 0.0
	if (c <= -8.6e-106)
		tmp = t_1;
	elseif (c <= 1e-183)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(y * x)) - Float64(Float64(i * c) * a)));
	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[(z * t + N[((-c) * N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -8.6e-106], t$95$1, If[LessEqual[c, 1e-183], N[(2.0 * N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(i * c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -8.6000000000000004e-106 or 1.00000000000000001e-183 < c

    1. Initial program 87.4%

      \[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 \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i}\right) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(z \cdot t + \left(y \cdot x - \color{blue}{\left(\left(c \cdot b + a\right) \cdot i\right)} \cdot c\right)\right) \]
    5. Applied rewrites93.7%

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

    if -8.6000000000000004e-106 < c < 1.00000000000000001e-183

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 93.4% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -8.6000000000000004e-106 or 1.00000000000000001e-183 < c

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.6000000000000004e-106 < c < 1.00000000000000001e-183

    1. Initial program 98.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 44.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 2 \cdot \left(y \cdot x\right)\\ \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-13}:\\ \;\;\;\;2 \cdot \left(t \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* 2.0 (* y x))))
   (if (<= (* x y) -5e+48) t_1 (if (<= (* x y) 2e-13) (* 2.0 (* 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 = 2.0 * (y * x);
	double tmp;
	if ((x * y) <= -5e+48) {
		tmp = t_1;
	} else if ((x * y) <= 2e-13) {
		tmp = 2.0 * (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 = 2.0d0 * (y * x)
    if ((x * y) <= (-5d+48)) then
        tmp = t_1
    else if ((x * y) <= 2d-13) then
        tmp = 2.0d0 * (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 = 2.0 * (y * x);
	double tmp;
	if ((x * y) <= -5e+48) {
		tmp = t_1;
	} else if ((x * y) <= 2e-13) {
		tmp = 2.0 * (t * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = 2.0 * (y * x)
	tmp = 0
	if (x * y) <= -5e+48:
		tmp = t_1
	elif (x * y) <= 2e-13:
		tmp = 2.0 * (t * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(2.0 * Float64(y * x))
	tmp = 0.0
	if (Float64(x * y) <= -5e+48)
		tmp = t_1;
	elseif (Float64(x * y) <= 2e-13)
		tmp = Float64(2.0 * Float64(t * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = 2.0 * (y * x);
	tmp = 0.0;
	if ((x * y) <= -5e+48)
		tmp = t_1;
	elseif ((x * y) <= 2e-13)
		tmp = 2.0 * (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[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+48], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-13], N[(2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 2 \cdot \left(y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.99999999999999973e48 or 2.0000000000000001e-13 < (*.f64 x y)

    1. Initial program 88.4%

      \[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 2 \cdot \color{blue}{\left(x \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 2 \cdot \left(y \cdot \color{blue}{x}\right) \]
      2. lower-*.f6450.7

        \[\leadsto 2 \cdot \left(y \cdot \color{blue}{x}\right) \]
    4. Applied rewrites50.7%

      \[\leadsto 2 \cdot \color{blue}{\left(y \cdot x\right)} \]

    if -4.99999999999999973e48 < (*.f64 x y) < 2.0000000000000001e-13

    1. Initial program 92.3%

      \[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 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
    3. Step-by-step derivation
      1. lower-*.f6438.2

        \[\leadsto 2 \cdot \left(t \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.2%

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

Alternative 13: 29.7% accurate, 3.6× speedup?

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

\\
2 \cdot \left(t \cdot z\right)
\end{array}
Derivation
  1. Initial program 90.4%

    \[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 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  3. Step-by-step derivation
    1. lower-*.f6429.7

      \[\leadsto 2 \cdot \left(t \cdot \color{blue}{z}\right) \]
  4. Applied rewrites29.7%

    \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
  5. Add Preprocessing

Developer Target 1: 94.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\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(a + Float64(b * c)) * Float64(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[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Reproduce

?
herbie shell --seed 2025096 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :alt
  (! :herbie-platform default (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))

  (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))