Average Error: 6.7 → 2.8
Time: 11.9s
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} \mathbf{if}\;c \cdot \left(a + b \cdot c\right) \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}\;c \cdot \left(a + b \cdot c\right) \leq 2.59268021622475 \cdot 10^{+246}:\\ \;\;\;\;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) - c \cdot \left(c \cdot \left(b \cdot i\right) + \frac{i}{a}\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}\;c \cdot \left(a + b \cdot c\right) \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}\;c \cdot \left(a + b \cdot c\right) \leq 2.59268021622475 \cdot 10^{+246}:\\
\;\;\;\;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) - c \cdot \left(c \cdot \left(b \cdot i\right) + \frac{i}{a}\right)\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))))
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= (* c (+ a (* b c))) (- INFINITY))
   (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
   (if (<= (* c (+ a (* b c))) 2.59268021622475e+246)
     (* 2.0 (- (+ (* x y) (* z t)) (* (* c (+ a (* b c))) i)))
     (* 2.0 (- (+ (* x y) (* z t)) (* c (+ (* c (* b i)) (/ i a))))))))
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 tmp;
	if ((c * (a + (b * c))) <= -((double) INFINITY)) {
		tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
	} else if ((c * (a + (b * c))) <= 2.59268021622475e+246) {
		tmp = 2.0 * (((x * y) + (z * t)) - ((c * (a + (b * c))) * i));
	} else {
		tmp = 2.0 * (((x * y) + (z * t)) - (c * ((c * (b * i)) + (i / a))));
	}
	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.7
Target1.9
Herbie2.8
\[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 a (*.f64 b c)) c) < -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*_binary64_1502311.8

      \[\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 a (*.f64 b c)) c) < 2.59268021622474992e246

    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 2.59268021622474992e246 < (*.f64 (+.f64 a (*.f64 b c)) c)

    1. Initial program 42.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. Taylor expanded around inf 52.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \cdot \left(a + b \cdot c\right) \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}\;c \cdot \left(a + b \cdot c\right) \leq 2.59268021622475 \cdot 10^{+246}:\\ \;\;\;\;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) - c \cdot \left(c \cdot \left(b \cdot i\right) + \frac{i}{a}\right)\right)\\ \end{array}\]

Reproduce

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