Average Error: 3.5 → 1.0
Time: 17.1s
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 -2.650881364761815326323235275736487933061 \cdot 10^{68} \lor \neg \left(t \le 1.640842751353321240815152205887361130947 \cdot 10^{-149}\right):\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + 27 \cdot \left(a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \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 -2.650881364761815326323235275736487933061 \cdot 10^{68} \lor \neg \left(t \le 1.640842751353321240815152205887361130947 \cdot 10^{-149}\right):\\
\;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + 27 \cdot \left(a \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \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 r435427 = x;
        double r435428 = 2.0;
        double r435429 = r435427 * r435428;
        double r435430 = y;
        double r435431 = 9.0;
        double r435432 = r435430 * r435431;
        double r435433 = z;
        double r435434 = r435432 * r435433;
        double r435435 = t;
        double r435436 = r435434 * r435435;
        double r435437 = r435429 - r435436;
        double r435438 = a;
        double r435439 = 27.0;
        double r435440 = r435438 * r435439;
        double r435441 = b;
        double r435442 = r435440 * r435441;
        double r435443 = r435437 + r435442;
        return r435443;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r435444 = t;
        double r435445 = -2.6508813647618153e+68;
        bool r435446 = r435444 <= r435445;
        double r435447 = 1.6408427513533212e-149;
        bool r435448 = r435444 <= r435447;
        double r435449 = !r435448;
        bool r435450 = r435446 || r435449;
        double r435451 = 2.0;
        double r435452 = x;
        double r435453 = r435451 * r435452;
        double r435454 = 9.0;
        double r435455 = z;
        double r435456 = y;
        double r435457 = r435455 * r435456;
        double r435458 = r435444 * r435457;
        double r435459 = r435454 * r435458;
        double r435460 = r435453 - r435459;
        double r435461 = 27.0;
        double r435462 = a;
        double r435463 = b;
        double r435464 = r435462 * r435463;
        double r435465 = r435461 * r435464;
        double r435466 = r435460 + r435465;
        double r435467 = r435452 * r435451;
        double r435468 = r435456 * r435454;
        double r435469 = r435455 * r435444;
        double r435470 = r435468 * r435469;
        double r435471 = r435467 - r435470;
        double r435472 = r435462 * r435461;
        double r435473 = r435472 * r435463;
        double r435474 = r435471 + r435473;
        double r435475 = r435450 ? r435466 : r435474;
        return r435475;
}

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.0
\[\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 < -2.6508813647618153e+68 or 1.6408427513533212e-149 < t

    1. Initial program 1.3

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Taylor expanded around inf 1.3

      \[\leadsto \color{blue}{\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)} + \left(a \cdot 27\right) \cdot b\]
    3. Taylor expanded around 0 1.2

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

    if -2.6508813647618153e+68 < t < 1.6408427513533212e-149

    1. Initial program 5.7

      \[\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*0.7

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

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

Reproduce

herbie shell --seed 2019303 +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)))