Average Error: 6.5 → 2.6
Time: 23.7s
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(c \cdot b + a\right) \cdot c = -\infty:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + t \cdot z\right) - \left(c \cdot i\right) \cdot \left(c \cdot b + a\right)\right)\\ \mathbf{elif}\;\left(c \cdot b + a\right) \cdot c \le 6.021484237276086580724395907462419021694 \cdot 10^{301}:\\ \;\;\;\;2 \cdot \left(\left(t \cdot z - i \cdot \left(\left(c \cdot b + a\right) \cdot c\right)\right) + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\left(x \cdot y + t \cdot z\right) - \left(\left(c \cdot i\right) \cdot a + \left(\left(c \cdot c\right) \cdot i\right) \cdot b\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(c \cdot b + a\right) \cdot c = -\infty:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + t \cdot z\right) - \left(c \cdot i\right) \cdot \left(c \cdot b + a\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + t \cdot z\right) - \left(\left(c \cdot i\right) \cdot a + \left(\left(c \cdot c\right) \cdot i\right) \cdot b\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r33394490 = 2.0;
        double r33394491 = x;
        double r33394492 = y;
        double r33394493 = r33394491 * r33394492;
        double r33394494 = z;
        double r33394495 = t;
        double r33394496 = r33394494 * r33394495;
        double r33394497 = r33394493 + r33394496;
        double r33394498 = a;
        double r33394499 = b;
        double r33394500 = c;
        double r33394501 = r33394499 * r33394500;
        double r33394502 = r33394498 + r33394501;
        double r33394503 = r33394502 * r33394500;
        double r33394504 = i;
        double r33394505 = r33394503 * r33394504;
        double r33394506 = r33394497 - r33394505;
        double r33394507 = r33394490 * r33394506;
        return r33394507;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i) {
        double r33394508 = c;
        double r33394509 = b;
        double r33394510 = r33394508 * r33394509;
        double r33394511 = a;
        double r33394512 = r33394510 + r33394511;
        double r33394513 = r33394512 * r33394508;
        double r33394514 = -inf.0;
        bool r33394515 = r33394513 <= r33394514;
        double r33394516 = 2.0;
        double r33394517 = x;
        double r33394518 = y;
        double r33394519 = r33394517 * r33394518;
        double r33394520 = t;
        double r33394521 = z;
        double r33394522 = r33394520 * r33394521;
        double r33394523 = r33394519 + r33394522;
        double r33394524 = i;
        double r33394525 = r33394508 * r33394524;
        double r33394526 = r33394525 * r33394512;
        double r33394527 = r33394523 - r33394526;
        double r33394528 = r33394516 * r33394527;
        double r33394529 = 6.021484237276087e+301;
        bool r33394530 = r33394513 <= r33394529;
        double r33394531 = r33394524 * r33394513;
        double r33394532 = r33394522 - r33394531;
        double r33394533 = r33394532 + r33394519;
        double r33394534 = r33394516 * r33394533;
        double r33394535 = r33394525 * r33394511;
        double r33394536 = r33394508 * r33394508;
        double r33394537 = r33394536 * r33394524;
        double r33394538 = r33394537 * r33394509;
        double r33394539 = r33394535 + r33394538;
        double r33394540 = r33394523 - r33394539;
        double r33394541 = r33394516 * r33394540;
        double r33394542 = r33394530 ? r33394534 : r33394541;
        double r33394543 = r33394515 ? r33394528 : r33394542;
        return r33394543;
}

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.5
Target2.1
Herbie2.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 (* (+ a (* 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*11.3

      \[\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 < (* (+ a (* b c)) c) < 6.021484237276087e+301

    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)\]
    2. Using strategy rm
    3. Applied associate--l+0.4

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

    if 6.021484237276087e+301 < (* (+ a (* b c)) c)

    1. Initial program 61.5

      \[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 53.9

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

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x y z t a b c i)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"

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

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