Average Error: 6.0 → 1.2
Time: 10.6s
Precision: binary64
\[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} t_1 := x \cdot y + z \cdot t\\ t_2 := a + b \cdot c\\ t_3 := \left(c \cdot t_2\right) \cdot i\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;2 \cdot \left(t_1 - t_2 \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;t_3 \leq 5.29042202284554 \cdot 10^{+307}:\\ \;\;\;\;2 \cdot \left(t_1 - t_3\right)\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_4 := \sqrt{c \cdot \left(t_2 \cdot i\right)}\\ 2 \cdot \left(t_1 - t_4 \cdot t_4\right) \end{array}\\ \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}
t_1 := x \cdot y + z \cdot t\\
t_2 := a + b \cdot c\\
t_3 := \left(c \cdot t_2\right) \cdot i\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;2 \cdot \left(t_1 - t_2 \cdot \left(c \cdot i\right)\right)\\

\mathbf{elif}\;t_3 \leq 5.29042202284554 \cdot 10^{+307}:\\
\;\;\;\;2 \cdot \left(t_1 - t_3\right)\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt{c \cdot \left(t_2 \cdot i\right)}\\
2 \cdot \left(t_1 - t_4 \cdot t_4\right)
\end{array}\\


\end{array}
(FPCore (x y z t a b c i)
 :precision binary64
 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ a (* b c))) (t_3 (* (* c t_2) i)))
   (if (<= t_3 (- INFINITY))
     (* 2.0 (- t_1 (* t_2 (* c i))))
     (if (<= t_3 5.29042202284554e+307)
       (* 2.0 (- t_1 t_3))
       (let* ((t_4 (sqrt (* c (* t_2 i))))) (* 2.0 (- t_1 (* t_4 t_4))))))))
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 t_1 = (x * y) + (z * t);
	double t_2 = a + (b * c);
	double t_3 = (c * t_2) * i;
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = 2.0 * (t_1 - (t_2 * (c * i)));
	} else if (t_3 <= 5.29042202284554e+307) {
		tmp = 2.0 * (t_1 - t_3);
	} else {
		double t_4 = sqrt(c * (t_2 * i));
		tmp = 2.0 * (t_1 - (t_4 * t_4));
	}
	return tmp;
}

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.0
Target1.8
Herbie1.2
\[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 (*.f64 (*.f64 (+.f64 a (*.f64 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*_binary649.9

      \[\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) \]

    if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.29042202284553989e307

    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) \]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary640.6

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

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

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(\sqrt[3]{c \cdot \left(a + b \cdot c\right)} \cdot \sqrt[3]{c \cdot \left(a + b \cdot c\right)}\right) \cdot \color{blue}{\sqrt[3]{c \cdot \left(a + b \cdot c\right)}}\right) \cdot i\right) \]
    6. Using strategy rm
    7. Applied *-un-lft-identity_binary640.6

      \[\leadsto 2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(\sqrt[3]{c \cdot \left(a + b \cdot c\right)} \cdot \sqrt[3]{c \cdot \left(a + b \cdot c\right)}\right) \cdot \sqrt[3]{c \cdot \left(a + b \cdot c\right)}\right) \cdot \color{blue}{\left(1 \cdot i\right)}\right) \]
    8. Applied associate-*r*_binary640.6

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

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

    if 5.29042202284553989e307 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)

    1. Initial program 63.8

      \[2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right) \]
    2. Using strategy rm
    3. Applied add-sqr-sqrt_binary6463.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq -\infty:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\\ \mathbf{elif}\;\left(c \cdot \left(a + b \cdot c\right)\right) \cdot i \leq 5.29042202284554 \cdot 10^{+307}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \sqrt{c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)} \cdot \sqrt{c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2021190 
(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.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))

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