Average Error: 20.8 → 3.9
Time: 6.2s
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 -4.589443313900608057563261719623579478808 \cdot 10^{256}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{1}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \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 -3.660883699446386363531884082504499977721 \cdot 10^{-259}:\\ \;\;\;\;\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{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 0.0:\\ \;\;\;\;\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 7.262603721379823265225963415766089734851 \cdot 10^{295}:\\ \;\;\;\;\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}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}, \frac{b}{z \cdot c}\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 -4.589443313900608057563261719623579478808 \cdot 10^{256}:\\
\;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{1}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \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 -3.660883699446386363531884082504499977721 \cdot 10^{-259}:\\
\;\;\;\;\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{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 0.0:\\
\;\;\;\;\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 7.262603721379823265225963415766089734851 \cdot 10^{295}:\\
\;\;\;\;\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}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}, \frac{b}{z \cdot c}\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r777505 = x;
        double r777506 = 9.0;
        double r777507 = r777505 * r777506;
        double r777508 = y;
        double r777509 = r777507 * r777508;
        double r777510 = z;
        double r777511 = 4.0;
        double r777512 = r777510 * r777511;
        double r777513 = t;
        double r777514 = r777512 * r777513;
        double r777515 = a;
        double r777516 = r777514 * r777515;
        double r777517 = r777509 - r777516;
        double r777518 = b;
        double r777519 = r777517 + r777518;
        double r777520 = c;
        double r777521 = r777510 * r777520;
        double r777522 = r777519 / r777521;
        return r777522;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r777523 = x;
        double r777524 = 9.0;
        double r777525 = r777523 * r777524;
        double r777526 = y;
        double r777527 = r777525 * r777526;
        double r777528 = z;
        double r777529 = 4.0;
        double r777530 = r777528 * r777529;
        double r777531 = t;
        double r777532 = r777530 * r777531;
        double r777533 = a;
        double r777534 = r777532 * r777533;
        double r777535 = r777527 - r777534;
        double r777536 = b;
        double r777537 = r777535 + r777536;
        double r777538 = c;
        double r777539 = r777528 * r777538;
        double r777540 = r777537 / r777539;
        double r777541 = -4.589443313900608e+256;
        bool r777542 = r777540 <= r777541;
        double r777543 = -r777529;
        double r777544 = 1.0;
        double r777545 = r777538 / r777533;
        double r777546 = r777544 / r777545;
        double r777547 = r777531 * r777546;
        double r777548 = r777539 / r777526;
        double r777549 = r777523 / r777548;
        double r777550 = r777536 / r777539;
        double r777551 = fma(r777524, r777549, r777550);
        double r777552 = fma(r777543, r777547, r777551);
        double r777553 = -3.6608836994463864e-259;
        bool r777554 = r777540 <= r777553;
        double r777555 = 0.0;
        bool r777556 = r777540 <= r777555;
        double r777557 = r777531 / r777545;
        double r777558 = r777524 * r777523;
        double r777559 = fma(r777558, r777526, r777536);
        double r777560 = r777559 / r777528;
        double r777561 = r777560 / r777538;
        double r777562 = fma(r777543, r777557, r777561);
        double r777563 = 7.262603721379823e+295;
        bool r777564 = r777540 <= r777563;
        double r777565 = cbrt(r777526);
        double r777566 = r777565 * r777565;
        double r777567 = r777528 / r777566;
        double r777568 = r777538 / r777565;
        double r777569 = r777567 * r777568;
        double r777570 = r777523 / r777569;
        double r777571 = fma(r777524, r777570, r777550);
        double r777572 = fma(r777543, r777557, r777571);
        double r777573 = r777564 ? r777540 : r777572;
        double r777574 = r777556 ? r777562 : r777573;
        double r777575 = r777554 ? r777540 : r777574;
        double r777576 = r777542 ? r777552 : r777575;
        return r777576;
}

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.8
Target14.6
Herbie3.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.100156740804105117061698089246936481893 \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.170887791174748819600820354912645756062 \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.876823679546137226963937101710277849382 \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.383851504245631860711731716196098366993 \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)) < -4.589443313900608e+256

    1. Initial program 43.2

      \[\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. Simplified20.8

      \[\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-/l*17.8

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

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

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

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

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

    if -4.589443313900608e+256 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -3.6608836994463864e-259 or 0.0 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 7.262603721379823e+295

    1. Initial program 3.8

      \[\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 -3.6608836994463864e-259 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 0.0

    1. Initial program 34.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. Simplified22.9

      \[\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-/l*24.3

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

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

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

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

    1. Initial program 61.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. Simplified30.0

      \[\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-/l*26.4

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

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

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

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c}\right)\right)\]
    9. Using strategy rm
    10. Applied add-cube-cbrt16.4

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

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\color{blue}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}}, \frac{b}{z \cdot c}\right)\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification3.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 -4.589443313900608057563261719623579478808 \cdot 10^{256}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{1}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \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 -3.660883699446386363531884082504499977721 \cdot 10^{-259}:\\ \;\;\;\;\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{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 0.0:\\ \;\;\;\;\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 7.262603721379823265225963415766089734851 \cdot 10^{295}:\\ \;\;\;\;\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}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}, \frac{b}{z \cdot c}\right)\right)\\ \end{array}\]

Reproduce

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