Average Error: 6.1 → 1.6
Time: 7.3s
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(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)} \cdot \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\\ \mathbf{elif}\;\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 3.97670597644814273 \cdot 10^{297}:\\ \;\;\;\;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}:\\ \;\;\;\;2 \cdot \left(\sqrt{\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)} \cdot \sqrt{\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\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(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)} \cdot \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\\

\mathbf{elif}\;\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 3.97670597644814273 \cdot 10^{297}:\\
\;\;\;\;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}:\\
\;\;\;\;2 \cdot \left(\sqrt{\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)} \cdot \sqrt{\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\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 (((((x * y) + (z * t)) - (((a + (b * c)) * c) * i)) <= -inf.0)) {
		VAR = (2.0 * (((x * y) + (z * t)) - (sqrt(((a + (b * c)) * (c * i))) * sqrt(((a + (b * c)) * (c * i))))));
	} else {
		double VAR_1;
		if (((((x * y) + (z * t)) - (((a + (b * c)) * c) * i)) <= 3.976705976448143e+297)) {
			VAR_1 = (2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)));
		} else {
			VAR_1 = (2.0 * (sqrt((((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))) * sqrt((((x * y) + (z * t)) - ((a + (b * c)) * (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.1
Target1.9
Herbie1.6
\[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 (- (+ (* x y) (* z t)) (* (* (+ 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. Using strategy rm
    3. Applied associate-*l*10.6

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt10.8

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

    if -inf.0 < (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i)) < 3.976705976448143e+297

    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 3.976705976448143e+297 < (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))

    1. Initial program 50.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. Using strategy rm
    3. Applied associate-*l*9.6

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \color{blue}{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt15.1

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

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

Reproduce

herbie shell --seed 2020092 
(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))))