Average Error: 20.7 → 6.9
Time: 6.6s
Precision: 64
\[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le -6.6758011168071027 \cdot 10^{-31}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 2.9175736342481858 \cdot 10^{-225}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 1.4854174770591123 \cdot 10^{307}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{1}{\frac{c}{\mathsf{fma}\left(9, x \cdot \frac{y}{z}, \frac{b}{z}\right)}}\right)\\ \end{array}\]
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le -6.6758011168071027 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c}\right)\right)\\

\mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 2.9175736342481858 \cdot 10^{-225}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\

\mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 1.4854174770591123 \cdot 10^{307}:\\
\;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{1}{\frac{c}{\mathsf{fma}\left(9, x \cdot \frac{y}{z}, \frac{b}{z}\right)}}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r741527 = x;
        double r741528 = 9.0;
        double r741529 = r741527 * r741528;
        double r741530 = y;
        double r741531 = r741529 * r741530;
        double r741532 = z;
        double r741533 = 4.0;
        double r741534 = r741532 * r741533;
        double r741535 = t;
        double r741536 = r741534 * r741535;
        double r741537 = a;
        double r741538 = r741536 * r741537;
        double r741539 = r741531 - r741538;
        double r741540 = b;
        double r741541 = r741539 + r741540;
        double r741542 = c;
        double r741543 = r741532 * r741542;
        double r741544 = r741541 / r741543;
        return r741544;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r741545 = x;
        double r741546 = 9.0;
        double r741547 = r741545 * r741546;
        double r741548 = y;
        double r741549 = r741547 * r741548;
        double r741550 = z;
        double r741551 = 4.0;
        double r741552 = r741550 * r741551;
        double r741553 = t;
        double r741554 = r741552 * r741553;
        double r741555 = a;
        double r741556 = r741554 * r741555;
        double r741557 = r741549 - r741556;
        double r741558 = b;
        double r741559 = r741557 + r741558;
        double r741560 = c;
        double r741561 = r741550 * r741560;
        double r741562 = r741559 / r741561;
        double r741563 = -6.675801116807103e-31;
        bool r741564 = r741562 <= r741563;
        double r741565 = -r741551;
        double r741566 = r741553 * r741555;
        double r741567 = r741566 / r741560;
        double r741568 = r741545 * r741548;
        double r741569 = r741568 / r741561;
        double r741570 = r741558 / r741561;
        double r741571 = fma(r741546, r741569, r741570);
        double r741572 = fma(r741565, r741567, r741571);
        double r741573 = 2.917573634248186e-225;
        bool r741574 = r741562 <= r741573;
        double r741575 = r741560 / r741555;
        double r741576 = r741553 / r741575;
        double r741577 = r741546 * r741545;
        double r741578 = fma(r741577, r741548, r741558);
        double r741579 = r741578 / r741550;
        double r741580 = r741579 / r741560;
        double r741581 = fma(r741565, r741576, r741580);
        double r741582 = 1.4854174770591123e+307;
        bool r741583 = r741562 <= r741582;
        double r741584 = 1.0;
        double r741585 = r741548 / r741550;
        double r741586 = r741545 * r741585;
        double r741587 = r741558 / r741550;
        double r741588 = fma(r741546, r741586, r741587);
        double r741589 = r741560 / r741588;
        double r741590 = r741584 / r741589;
        double r741591 = fma(r741565, r741567, r741590);
        double r741592 = r741583 ? r741562 : r741591;
        double r741593 = r741574 ? r741581 : r741592;
        double r741594 = r741564 ? r741572 : r741593;
        return r741594;
}

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

Target

Original20.7
Target14.6
Herbie6.9
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.10015674080410512 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.17088779117474882 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.8768236795461372 \cdot 10^{130}:\\ \;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.3838515042456319 \cdot 10^{158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -6.675801116807103e-31

    1. Initial program 16.0

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified9.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Taylor expanded around 0 9.4

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}}\right)\]
    4. Simplified9.4

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c}\right)}\right)\]

    if -6.675801116807103e-31 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 2.917573634248186e-225

    1. Initial program 20.5

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified12.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/r*0.9

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\frac{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}}{c}}\right)\]
    5. Simplified1.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\color{blue}{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}}{c}\right)\]
    6. Using strategy rm
    7. Applied associate-/l*2.8

      \[\leadsto \mathsf{fma}\left(-4, \color{blue}{\frac{t}{\frac{c}{a}}}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\]

    if 2.917573634248186e-225 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 1.4854174770591123e+307

    1. Initial program 0.6

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]

    if 1.4854174770591123e+307 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))

    1. Initial program 63.7

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified31.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/r*27.7

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\frac{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}}{c}}\right)\]
    5. Simplified28.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\color{blue}{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}}{c}\right)\]
    6. Taylor expanded around 0 27.6

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\color{blue}{9 \cdot \frac{x \cdot y}{z} + \frac{b}{z}}}{c}\right)\]
    7. Simplified27.6

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z}, \frac{b}{z}\right)}}{c}\right)\]
    8. Using strategy rm
    9. Applied *-un-lft-identity27.6

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(9, \frac{x \cdot y}{\color{blue}{1 \cdot z}}, \frac{b}{z}\right)}{c}\right)\]
    10. Applied times-frac17.7

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(9, \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}, \frac{b}{z}\right)}{c}\right)\]
    11. Simplified17.7

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(9, \color{blue}{x} \cdot \frac{y}{z}, \frac{b}{z}\right)}{c}\right)\]
    12. Using strategy rm
    13. Applied clear-num17.7

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\frac{1}{\frac{c}{\mathsf{fma}\left(9, x \cdot \frac{y}{z}, \frac{b}{z}\right)}}}\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le -6.6758011168071027 \cdot 10^{-31}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 2.9175736342481858 \cdot 10^{-225}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 1.4854174770591123 \cdot 10^{307}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{1}{\frac{c}{\mathsf{fma}\left(9, x \cdot \frac{y}{z}, \frac{b}{z}\right)}}\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)))