Average Error: 6.3 → 1.9
Time: 7.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(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot x, y, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 1.26303150478254523 \cdot 10^{304}:\\ \;\;\;\;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), 2 \cdot \left(\left(-\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot c\right) \cdot i\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(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot x, y, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\

\mathbf{elif}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 1.26303150478254523 \cdot 10^{304}:\\
\;\;\;\;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), 2 \cdot \left(\left(-\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot c\right) \cdot i\right)\right)\right)\\

\end{array}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (((double) (((double) (a + ((double) (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 ((((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i)) <= -inf.0)) {
		VAR = ((double) fma(((double) (2.0 * x)), y, ((double) (2.0 * ((double) (((double) -(((double) fma(c, b, a)))) * ((double) (c * i))))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i)) <= 1.2630315047825452e+304)) {
			VAR_1 = ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i))))));
		} else {
			VAR_1 = ((double) fma(2.0, ((double) fma(x, y, ((double) (z * t)))), ((double) (2.0 * ((double) (((double) -(((double) (((double) cbrt(((double) fma(c, b, a)))) * ((double) cbrt(((double) fma(c, b, a)))))))) * ((double) (((double) (((double) cbrt(((double) 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

Original6.3
Target1.7
Herbie1.9
\[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) i) < -inf.0

    1. Initial program 64.0

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\]
    2. Simplified9.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. Taylor expanded around inf 9.3

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

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

      \[\leadsto \color{blue}{2 \cdot \left(x \cdot y\right) - \left(2 \cdot \left(i \cdot \left(b \cdot {c}^{2}\right)\right) + 2 \cdot \left(a \cdot \left(i \cdot c\right)\right)\right)}\]
    6. Simplified15.0

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

    if -inf.0 < (* (* (+ a (* b c)) c) i) < 1.2630315047825452e+304

    1. Initial program 0.4

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

    if 1.2630315047825452e+304 < (* (* (+ a (* b c)) c) i)

    1. Initial program 61.7

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

      \[\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-cube-cbrt9.0

      \[\leadsto \mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}}\right) \cdot \left(c \cdot i\right)\right)\right)\]
    5. Applied distribute-lft-neg-in9.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot x, y, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\ \mathbf{elif}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 1.26303150478254523 \cdot 10^{304}:\\ \;\;\;\;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), 2 \cdot \left(\left(-\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot c\right) \cdot i\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020122 +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))))