Average Error: 4.0 → 0.6
Time: 5.7s
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}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t = -\infty:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 3.136430946920042428949916649066591619343 \cdot 10^{-268}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 8.865806292802842715458387117425740404034 \cdot 10^{307}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + 27 \cdot \left(a \cdot b\right)\\ \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}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t = -\infty:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\

\mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 3.136430946920042428949916649066591619343 \cdot 10^{-268}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

\mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 8.865806292802842715458387117425740404034 \cdot 10^{307}:\\
\;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r671563 = x;
        double r671564 = 2.0;
        double r671565 = r671563 * r671564;
        double r671566 = y;
        double r671567 = 9.0;
        double r671568 = r671566 * r671567;
        double r671569 = z;
        double r671570 = r671568 * r671569;
        double r671571 = t;
        double r671572 = r671570 * r671571;
        double r671573 = r671565 - r671572;
        double r671574 = a;
        double r671575 = 27.0;
        double r671576 = r671574 * r671575;
        double r671577 = b;
        double r671578 = r671576 * r671577;
        double r671579 = r671573 + r671578;
        return r671579;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r671580 = x;
        double r671581 = 2.0;
        double r671582 = r671580 * r671581;
        double r671583 = y;
        double r671584 = 9.0;
        double r671585 = r671583 * r671584;
        double r671586 = z;
        double r671587 = r671585 * r671586;
        double r671588 = t;
        double r671589 = r671587 * r671588;
        double r671590 = r671582 - r671589;
        double r671591 = -inf.0;
        bool r671592 = r671590 <= r671591;
        double r671593 = r671584 * r671586;
        double r671594 = r671593 * r671588;
        double r671595 = r671583 * r671594;
        double r671596 = r671582 - r671595;
        double r671597 = a;
        double r671598 = 27.0;
        double r671599 = r671597 * r671598;
        double r671600 = b;
        double r671601 = r671599 * r671600;
        double r671602 = r671596 + r671601;
        double r671603 = 3.1364309469200424e-268;
        bool r671604 = r671590 <= r671603;
        double r671605 = r671598 * r671600;
        double r671606 = r671597 * r671605;
        double r671607 = r671590 + r671606;
        double r671608 = 8.865806292802843e+307;
        bool r671609 = r671590 <= r671608;
        double r671610 = r671581 * r671580;
        double r671611 = r671586 * r671583;
        double r671612 = r671588 * r671611;
        double r671613 = r671584 * r671612;
        double r671614 = r671610 - r671613;
        double r671615 = r671614 + r671601;
        double r671616 = r671586 * r671588;
        double r671617 = r671585 * r671616;
        double r671618 = r671582 - r671617;
        double r671619 = r671597 * r671600;
        double r671620 = r671598 * r671619;
        double r671621 = r671618 + r671620;
        double r671622 = r671609 ? r671615 : r671621;
        double r671623 = r671604 ? r671607 : r671622;
        double r671624 = r671592 ? r671602 : r671623;
        return r671624;
}

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

Original4.0
Target2.7
Herbie0.6
\[\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 4 regimes
  2. if (- (* x 2.0) (* (* (* y 9.0) z) t)) < -inf.0

    1. Initial program 64.0

      \[\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.9

      \[\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\]
    4. Using strategy rm
    5. Applied associate-*l*0.6

      \[\leadsto \left(x \cdot 2 - \color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)}\right) + \left(a \cdot 27\right) \cdot b\]
    6. Using strategy rm
    7. Applied associate-*r*0.6

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

    if -inf.0 < (- (* x 2.0) (* (* (* y 9.0) z) t)) < 3.1364309469200424e-268

    1. Initial program 0.5

      \[\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.5

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

    if 3.1364309469200424e-268 < (- (* x 2.0) (* (* (* y 9.0) z) t)) < 8.865806292802843e+307

    1. Initial program 0.5

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

      \[\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\]
    4. Taylor expanded around inf 0.5

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

    if 8.865806292802843e+307 < (- (* x 2.0) (* (* (* y 9.0) z) t))

    1. Initial program 63.5

      \[\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.9

      \[\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\]
    4. Taylor expanded around 0 1.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t = -\infty:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 3.136430946920042428949916649066591619343 \cdot 10^{-268}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 8.865806292802842715458387117425740404034 \cdot 10^{307}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + 27 \cdot \left(a \cdot b\right)\\ \end{array}\]

Reproduce

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