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

Percentage Accurate: 89.6% → 96.3%
Time: 4.2s
Alternatives: 15
Speedup: 0.5×

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

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

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

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

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

Alternative 1: 96.3% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, \left(-i\right) \cdot \left(\mathsf{fma}\left(b, c, a\right) \cdot c\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 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, \mathsf{fma}\left(t, z, y \cdot x\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 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\left(-c\right) \cdot i\right) \cdot \left(c \cdot b + a\right)\right) \]
      17. lift-fma.f64N/A

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

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

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

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

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

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

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

Alternative 2: 94.9% 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 -\infty:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, t \cdot z\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+257}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - i \cdot \left(\mathsf{fma}\left(c, b, a\right) \cdot c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(\left(i \cdot c\right) \cdot -2\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 (- INFINITY))
     (* 2.0 (fma (fma c b a) (* (- c) i) (* t z)))
     (if (<= t_1 1e+257)
       (* 2.0 (fma y x (- (* t z) (* i (* (fma c b a) c)))))
       (* (fma b c a) (* (* i c) -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 <= -((double) INFINITY)) {
		tmp = 2.0 * fma(fma(c, b, a), (-c * i), (t * z));
	} else if (t_1 <= 1e+257) {
		tmp = 2.0 * fma(y, x, ((t * z) - (i * (fma(c, b, a) * c))));
	} else {
		tmp = fma(b, c, a) * ((i * c) * -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 <= Float64(-Inf))
		tmp = Float64(2.0 * fma(fma(c, b, a), Float64(Float64(-c) * i), Float64(t * z)));
	elseif (t_1 <= 1e+257)
		tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(i * Float64(fma(c, b, a) * c)))));
	else
		tmp = Float64(fma(b, c, a) * Float64(Float64(i * c) * -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, (-Infinity)], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[((-c) * i), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+257], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(i * N[(N[(c * b + a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * c + a), $MachinePrecision] * N[(N[(i * c), $MachinePrecision] * -2.0), $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 -\infty:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, t \cdot z\right)\\

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

Alternative 3: 88.7% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

    if -1e303 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e137

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\left(-c\right) \cdot i\right) \cdot \left(c \cdot b + a\right)\right) \]
      17. lift-fma.f64N/A

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

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

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

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

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

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

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

    if -5.0000000000000002e137 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Taylor expanded in b around 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. lower-*.f64N/A

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

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

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

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

    if 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

Alternative 4: 88.6% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

    if -1.9999999999999999e298 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e137

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\left(-c\right) \cdot i\right) \cdot \left(c \cdot b + a\right)\right) \]
      17. lift-fma.f64N/A

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, \left(-i\right) \cdot \left(\left(b \cdot c\right) \cdot c\right)\right) \]
    8. Step-by-step derivation
      1. lower-*.f6455.1

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

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

    if -5.0000000000000002e137 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Taylor expanded in b around 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. lower-*.f64N/A

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

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

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

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

Alternative 5: 87.3% 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 -4 \cdot 10^{+98}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, t \cdot z\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(\left(i \cdot c\right) \cdot -2\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 -4e+98)
     (* 2.0 (fma (fma c b a) (* (- c) i) (* t z)))
     (if (<= t_1 5e+157)
       (* 2.0 (- (fma t z (* x y)) (* a (* c i))))
       (* (fma b c a) (* (* i c) -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 <= -4e+98) {
		tmp = 2.0 * fma(fma(c, b, a), (-c * i), (t * z));
	} else if (t_1 <= 5e+157) {
		tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
	} else {
		tmp = fma(b, c, a) * ((i * c) * -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 <= -4e+98)
		tmp = Float64(2.0 * fma(fma(c, b, a), Float64(Float64(-c) * i), Float64(t * z)));
	elseif (t_1 <= 5e+157)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i))));
	else
		tmp = Float64(fma(b, c, a) * Float64(Float64(i * c) * -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, -4e+98], N[(2.0 * N[(N[(c * b + a), $MachinePrecision] * N[((-c) * i), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+157], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * c + a), $MachinePrecision] * N[(N[(i * c), $MachinePrecision] * -2.0), $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 -4 \cdot 10^{+98}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(c, b, a\right), \left(-c\right) \cdot i, t \cdot z\right)\\

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999999e98 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Taylor expanded in b around 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. lower-*.f64N/A

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

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

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

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

    if 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

Alternative 6: 86.7% 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 -5 \cdot 10^{+137}:\\ \;\;\;\;\left(x \cdot y - \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right) \cdot c\right) \cdot 2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\ \;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - a \cdot \left(c \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, a\right) \cdot \left(\left(i \cdot c\right) \cdot -2\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 -5e+137)
     (* (- (* x y) (* (* (fma b c a) i) c)) 2.0)
     (if (<= t_1 5e+157)
       (* 2.0 (- (fma t z (* x y)) (* a (* c i))))
       (* (fma b c a) (* (* i c) -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 <= -5e+137) {
		tmp = ((x * y) - ((fma(b, c, a) * i) * c)) * 2.0;
	} else if (t_1 <= 5e+157) {
		tmp = 2.0 * (fma(t, z, (x * y)) - (a * (c * i)));
	} else {
		tmp = fma(b, c, a) * ((i * c) * -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 <= -5e+137)
		tmp = Float64(Float64(Float64(x * y) - Float64(Float64(fma(b, c, a) * i) * c)) * 2.0);
	elseif (t_1 <= 5e+157)
		tmp = Float64(2.0 * Float64(fma(t, z, Float64(x * y)) - Float64(a * Float64(c * i))));
	else
		tmp = Float64(fma(b, c, a) * Float64(Float64(i * c) * -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, -5e+137], N[(N[(N[(x * y), $MachinePrecision] - N[(N[(N[(b * c + a), $MachinePrecision] * i), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+157], N[(2.0 * N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * c + a), $MachinePrecision] * N[(N[(i * c), $MachinePrecision] * -2.0), $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 -5 \cdot 10^{+137}:\\
\;\;\;\;\left(x \cdot y - \left(\mathsf{fma}\left(b, c, a\right) \cdot i\right) \cdot c\right) \cdot 2\\

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000002e137 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Taylor expanded in b around 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. lower-*.f64N/A

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

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

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

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

    if 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

Alternative 7: 82.6% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

    if -1.9999999999999999e298 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e137

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot \left(a + b \cdot c\right)\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot x + \left(\left(-c\right) \cdot i\right) \cdot \left(c \cdot b + a\right)\right) \]
      17. lift-fma.f64N/A

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \mathsf{fma}\left(y, x, \left(-i\right) \cdot \left(\left(b \cdot c\right) \cdot c\right)\right) \]
    8. Step-by-step derivation
      1. lower-*.f6455.1

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

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

    if -5.0000000000000002e137 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

Alternative 8: 82.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\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) < -3.99999999999999999e98 or 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(c \cdot i\right) \cdot \left(\mathsf{neg}\left(2\right)\right)\right) \]
      10. distribute-rgt-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\mathsf{neg}\left(\left(c \cdot i\right) \cdot 2\right)\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\mathsf{neg}\left(c \cdot i\right)\right) \cdot 2\right) \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(a + b \cdot c\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      14. lift-neg.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, c, a\right) \cdot \left(\left(\left(\mathsf{neg}\left(c\right)\right) \cdot i\right) \cdot 2\right) \]
      23. distribute-lft-neg-outN/A

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

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

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

    if -3.99999999999999999e98 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

Alternative 9: 80.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\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) < -3.99999999999999999e98 or 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(b, c, a\right) \cdot c\right) \cdot \left(i \cdot -2\right) \]
      19. lower-*.f6448.0

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

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

    if -3.99999999999999999e98 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

Alternative 10: 72.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 -5 \cdot 10^{+292}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(\left(i \cdot b\right) \cdot c\right)\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot i\right)\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 -5e+292)
     (* -2.0 (* c (* (* i b) c)))
     (if (<= t_1 5e+157)
       (* 2.0 (fma t z (* x y)))
       (* -2.0 (* c (* b (* c i))))))))
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 <= -5e+292) {
		tmp = -2.0 * (c * ((i * b) * c));
	} else if (t_1 <= 5e+157) {
		tmp = 2.0 * fma(t, z, (x * y));
	} else {
		tmp = -2.0 * (c * (b * (c * i)));
	}
	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 <= -5e+292)
		tmp = Float64(-2.0 * Float64(c * Float64(Float64(i * b) * c)));
	elseif (t_1 <= 5e+157)
		tmp = Float64(2.0 * fma(t, z, Float64(x * y)));
	else
		tmp = Float64(-2.0 * Float64(c * Float64(b * Float64(c * i))));
	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, -5e+292], N[(-2.0 * N[(c * N[(N[(i * b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+157], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(c * N[(b * N[(c * i), $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 -5 \cdot 10^{+292}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(i \cdot b\right) \cdot c\right)\right)\\

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot \color{blue}{i}\right)\right)\right) \]
      2. lower-*.f6434.6

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999996e292 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

    if 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot \color{blue}{i}\right)\right)\right) \]
      2. lower-*.f6434.6

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

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

Alternative 11: 72.6% 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 -5 \cdot 10^{+292}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(\left(b \cdot c\right) \cdot i\right)\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\ \;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot i\right)\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 -5e+292)
     (* -2.0 (* c (* (* b c) i)))
     (if (<= t_1 5e+157)
       (* 2.0 (fma t z (* x y)))
       (* -2.0 (* c (* b (* c i))))))))
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 <= -5e+292) {
		tmp = -2.0 * (c * ((b * c) * i));
	} else if (t_1 <= 5e+157) {
		tmp = 2.0 * fma(t, z, (x * y));
	} else {
		tmp = -2.0 * (c * (b * (c * i)));
	}
	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 <= -5e+292)
		tmp = Float64(-2.0 * Float64(c * Float64(Float64(b * c) * i)));
	elseif (t_1 <= 5e+157)
		tmp = Float64(2.0 * fma(t, z, Float64(x * y)));
	else
		tmp = Float64(-2.0 * Float64(c * Float64(b * Float64(c * i))));
	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, -5e+292], N[(-2.0 * N[(c * N[(N[(b * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+157], N[(2.0 * N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(c * N[(b * N[(c * i), $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 -5 \cdot 10^{+292}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(b \cdot c\right) \cdot i\right)\right)\\

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot \color{blue}{i}\right)\right)\right) \]
      2. lower-*.f6434.6

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(\left(b \cdot c\right) \cdot i\right)\right) \]
      5. lower-*.f6433.8

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

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

    if -4.9999999999999996e292 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

    if 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot \color{blue}{i}\right)\right)\right) \]
      2. lower-*.f6434.6

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

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

Alternative 12: 72.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\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) < -4.9999999999999996e292 or 4.99999999999999976e157 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -2 \cdot \left(c \cdot \left(b \cdot \left(c \cdot \color{blue}{i}\right)\right)\right) \]
      2. lower-*.f6434.6

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

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

    if -4.9999999999999996e292 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999976e157

    1. Initial program 89.6%

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

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

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

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

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

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

Alternative 13: 62.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+254}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(t, z, x \cdot y\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) < -1.9999999999999999e298 or 4.99999999999999994e254 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 89.6%

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

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

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

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

        \[\leadsto -2 \cdot \left(a \cdot \left(c \cdot \color{blue}{i}\right)\right) \]
    4. Applied rewrites26.2%

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

    if -1.9999999999999999e298 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.99999999999999994e254

    1. Initial program 89.6%

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

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

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

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

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

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

Alternative 14: 43.4% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -2.0000000000000002e-15 or 2.00000000000000003e43 < (*.f64 z t)

    1. Initial program 89.6%

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

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

        \[\leadsto 2 \cdot \color{blue}{\left(t \cdot z\right)} \]
      2. lower-*.f6429.5

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

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

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

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

        \[\leadsto 2 \cdot \left(z \cdot \color{blue}{t}\right) \]
      4. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot z\right) \cdot \color{blue}{t} \]
      6. count-2-revN/A

        \[\leadsto \left(z + z\right) \cdot t \]
      7. lower-+.f6429.5

        \[\leadsto \left(z + z\right) \cdot t \]
    6. Applied rewrites29.5%

      \[\leadsto \left(z + z\right) \cdot \color{blue}{t} \]

    if -2.0000000000000002e-15 < (*.f64 z t) < 2.00000000000000003e43

    1. Initial program 89.6%

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(y \cdot \color{blue}{x}\right) \]
      4. associate-*r*N/A

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

        \[\leadsto \left(2 \cdot y\right) \cdot \color{blue}{x} \]
      6. count-2-revN/A

        \[\leadsto \left(y + y\right) \cdot x \]
      7. lower-+.f6427.5

        \[\leadsto \left(y + y\right) \cdot x \]
    6. Applied rewrites27.5%

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

Alternative 15: 27.5% accurate, 4.0× speedup?

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

\\
\left(y + y\right) \cdot x
\end{array}
Derivation
  1. Initial program 89.6%

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(y \cdot \color{blue}{x}\right) \]
    4. associate-*r*N/A

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

      \[\leadsto \left(2 \cdot y\right) \cdot \color{blue}{x} \]
    6. count-2-revN/A

      \[\leadsto \left(y + y\right) \cdot x \]
    7. lower-+.f6427.5

      \[\leadsto \left(y + y\right) \cdot x \]
  6. Applied rewrites27.5%

    \[\leadsto \left(y + y\right) \cdot \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

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