Average Error: 5.9 → 1.3
Time: 9.9s
Precision: 64
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
\[\begin{array}{l} \mathbf{if}\;\left(a + b \cdot c\right) \cdot c \le -3.1861915954316597 \cdot 10^{216}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;\left(a + b \cdot c\right) \cdot c \le 4.53656211072419482 \cdot 10^{219}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), {\left(\sqrt{\sqrt{2}}\right)}^{3} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\\ \end{array}\]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\begin{array}{l}
\mathbf{if}\;\left(a + b \cdot c\right) \cdot c \le -3.1861915954316597 \cdot 10^{216}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\

\mathbf{elif}\;\left(a + b \cdot c\right) \cdot c \le 4.53656211072419482 \cdot 10^{219}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\\

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

\end{array}
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)));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double VAR;
	if ((((a + (b * c)) * c) <= -3.18619159543166e+216)) {
		VAR = fma(2.0, fma(x, y, (z * t)), (2.0 * (-fma(c, b, a) * (c * i))));
	} else {
		double VAR_1;
		if ((((a + (b * c)) * c) <= 4.536562110724195e+219)) {
			VAR_1 = (2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)));
		} else {
			VAR_1 = fma(2.0, fma(x, y, (z * t)), (pow(sqrt(sqrt(2.0)), 3.0) * (sqrt(sqrt(2.0)) * (-fma(c, b, a) * (c * i)))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.9
Target1.7
Herbie1.3
\[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\]

Derivation

  1. Split input into 3 regimes
  2. if (* (+ a (* b c)) c) < -3.18619159543166e+216

    1. Initial program 33.2

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
    2. Simplified5.4

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

    if -3.18619159543166e+216 < (* (+ a (* b c)) c) < 4.536562110724195e+219

    1. Initial program 0.3

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]

    if 4.536562110724195e+219 < (* (+ a (* b c)) c)

    1. Initial program 32.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt6.9

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), \color{blue}{\left(\sqrt{2} \cdot \sqrt{2}\right)} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\]
    5. Applied associate-*l*6.7

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), \color{blue}{\sqrt{2} \cdot \left(\sqrt{2} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)}\right)\]
    6. Using strategy rm
    7. Applied add-sqr-sqrt6.7

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

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), \sqrt{2} \cdot \left(\color{blue}{\left(\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{2}}\right)} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\]
    9. Applied associate-*l*6.4

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), \sqrt{2} \cdot \color{blue}{\left(\sqrt{\sqrt{2}} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)}\right)\]
    10. Using strategy rm
    11. Applied associate-*r*6.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(a + b \cdot c\right) \cdot c \le -3.1861915954316597 \cdot 10^{216}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;\left(a + b \cdot c\right) \cdot c \le 4.53656211072419482 \cdot 10^{219}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), {\left(\sqrt{\sqrt{2}}\right)}^{3} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

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