Average Error: 3.5 → 1.3
Time: 17.6s
Precision: 64
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.676106603176618479833130858551602850216 \cdot 10^{-187} \lor \neg \left(t \le 1.156508872709047150996877341481149061061 \cdot 10^{-29}\right):\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
\mathbf{if}\;t \le -5.676106603176618479833130858551602850216 \cdot 10^{-187} \lor \neg \left(t \le 1.156508872709047150996877341481149061061 \cdot 10^{-29}\right):\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r474487 = x;
        double r474488 = 2.0;
        double r474489 = r474487 * r474488;
        double r474490 = y;
        double r474491 = 9.0;
        double r474492 = r474490 * r474491;
        double r474493 = z;
        double r474494 = r474492 * r474493;
        double r474495 = t;
        double r474496 = r474494 * r474495;
        double r474497 = r474489 - r474496;
        double r474498 = a;
        double r474499 = 27.0;
        double r474500 = r474498 * r474499;
        double r474501 = b;
        double r474502 = r474500 * r474501;
        double r474503 = r474497 + r474502;
        return r474503;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r474504 = t;
        double r474505 = -5.676106603176618e-187;
        bool r474506 = r474504 <= r474505;
        double r474507 = 1.1565088727090472e-29;
        bool r474508 = r474504 <= r474507;
        double r474509 = !r474508;
        bool r474510 = r474506 || r474509;
        double r474511 = x;
        double r474512 = 2.0;
        double r474513 = r474511 * r474512;
        double r474514 = y;
        double r474515 = 9.0;
        double r474516 = z;
        double r474517 = r474515 * r474516;
        double r474518 = r474514 * r474517;
        double r474519 = r474518 * r474504;
        double r474520 = r474513 - r474519;
        double r474521 = a;
        double r474522 = 27.0;
        double r474523 = b;
        double r474524 = r474522 * r474523;
        double r474525 = r474521 * r474524;
        double r474526 = r474520 + r474525;
        double r474527 = r474517 * r474504;
        double r474528 = r474514 * r474527;
        double r474529 = r474513 - r474528;
        double r474530 = r474521 * r474522;
        double r474531 = r474530 * r474523;
        double r474532 = r474529 + r474531;
        double r474533 = r474510 ? r474526 : r474532;
        return r474533;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.5
Target2.6
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;y \lt 7.590524218811188954625810696587370427881 \cdot 10^{-161}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -5.676106603176618e-187 or 1.1565088727090472e-29 < t

    1. Initial program 1.6

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*1.6

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    4. Using strategy rm
    5. Applied associate-*l*1.6

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

    if -5.676106603176618e-187 < t < 1.1565088727090472e-29

    1. Initial program 6.6

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*6.6

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot \left(9 \cdot z\right)\right)} \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    4. Using strategy rm
    5. Applied associate-*l*0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.676106603176618479833130858551602850216 \cdot 10^{-187} \lor \neg \left(t \le 1.156508872709047150996877341481149061061 \cdot 10^{-29}\right):\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b)))

  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))