Average Error: 19.9 → 8.9
Time: 13.7s
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}\;z \le -3.33334025156112373 \cdot 10^{199}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z} \cdot \frac{y}{c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{elif}\;z \le -8.3785659762865011 \cdot 10^{68}:\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - 4 \cdot \left(t \cdot a\right)\right) \cdot \frac{1}{c}\\ \mathbf{elif}\;z \le -2.55639559574107117 \cdot 10^{-125}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{elif}\;z \le 7.2321727432478166 \cdot 10^{-217}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot y}{z \cdot c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;z \le 1.3341653186151825 \cdot 10^{189} \lor \neg \left(z \le 1.03779238211382713 \cdot 10^{252}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - 4 \cdot \left(t \cdot a\right)\right) \cdot \frac{1}{c}\\ \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}\;z \le -3.33334025156112373 \cdot 10^{199}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z} \cdot \frac{y}{c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\

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

\mathbf{elif}\;z \le -2.55639559574107117 \cdot 10^{-125}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\

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

\mathbf{elif}\;z \le 1.3341653186151825 \cdot 10^{189} \lor \neg \left(z \le 1.03779238211382713 \cdot 10^{252}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r778644 = x;
        double r778645 = 9.0;
        double r778646 = r778644 * r778645;
        double r778647 = y;
        double r778648 = r778646 * r778647;
        double r778649 = z;
        double r778650 = 4.0;
        double r778651 = r778649 * r778650;
        double r778652 = t;
        double r778653 = r778651 * r778652;
        double r778654 = a;
        double r778655 = r778653 * r778654;
        double r778656 = r778648 - r778655;
        double r778657 = b;
        double r778658 = r778656 + r778657;
        double r778659 = c;
        double r778660 = r778649 * r778659;
        double r778661 = r778658 / r778660;
        return r778661;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r778662 = z;
        double r778663 = -3.3333402515611237e+199;
        bool r778664 = r778662 <= r778663;
        double r778665 = x;
        double r778666 = r778665 / r778662;
        double r778667 = y;
        double r778668 = c;
        double r778669 = r778667 / r778668;
        double r778670 = r778666 * r778669;
        double r778671 = 9.0;
        double r778672 = b;
        double r778673 = r778662 * r778668;
        double r778674 = r778672 / r778673;
        double r778675 = fma(r778670, r778671, r778674);
        double r778676 = 4.0;
        double r778677 = a;
        double r778678 = cbrt(r778668);
        double r778679 = r778678 * r778678;
        double r778680 = r778677 / r778679;
        double r778681 = t;
        double r778682 = r778681 / r778678;
        double r778683 = r778680 * r778682;
        double r778684 = r778676 * r778683;
        double r778685 = r778675 - r778684;
        double r778686 = -8.378565976286501e+68;
        bool r778687 = r778662 <= r778686;
        double r778688 = r778665 * r778671;
        double r778689 = fma(r778688, r778667, r778672);
        double r778690 = r778689 / r778662;
        double r778691 = r778681 * r778677;
        double r778692 = r778676 * r778691;
        double r778693 = r778690 - r778692;
        double r778694 = 1.0;
        double r778695 = r778694 / r778668;
        double r778696 = r778693 * r778695;
        double r778697 = -2.556395595741071e-125;
        bool r778698 = r778662 <= r778697;
        double r778699 = r778665 * r778669;
        double r778700 = r778699 / r778662;
        double r778701 = fma(r778700, r778671, r778674);
        double r778702 = r778701 - r778684;
        double r778703 = 7.2321727432478166e-217;
        bool r778704 = r778662 <= r778703;
        double r778705 = r778665 * r778667;
        double r778706 = r778705 / r778673;
        double r778707 = fma(r778706, r778671, r778674);
        double r778708 = r778681 / r778668;
        double r778709 = r778677 * r778708;
        double r778710 = r778676 * r778709;
        double r778711 = r778707 - r778710;
        double r778712 = 1.3341653186151825e+189;
        bool r778713 = r778662 <= r778712;
        double r778714 = 1.0377923821138271e+252;
        bool r778715 = r778662 <= r778714;
        double r778716 = !r778715;
        bool r778717 = r778713 || r778716;
        double r778718 = r778717 ? r778702 : r778696;
        double r778719 = r778704 ? r778711 : r778718;
        double r778720 = r778698 ? r778702 : r778719;
        double r778721 = r778687 ? r778696 : r778720;
        double r778722 = r778664 ? r778685 : r778721;
        return r778722;
}

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

Original19.9
Target14.4
Herbie8.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 z < -3.3333402515611237e+199

    1. Initial program 40.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}\]
    2. Simplified9.9

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{x \cdot y}{z \cdot c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \color{blue}{\left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)}\]
    8. Using strategy rm
    9. Applied times-frac13.5

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

    if -3.3333402515611237e+199 < z < -8.378565976286501e+68 or 1.3341653186151825e+189 < z < 1.0377923821138271e+252

    1. Initial program 29.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. Simplified8.9

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

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

    if -8.378565976286501e+68 < z < -2.556395595741071e-125 or 7.2321727432478166e-217 < z < 1.3341653186151825e+189 or 1.0377923821138271e+252 < z

    1. Initial program 16.1

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

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

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

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

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

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

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

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

    if -2.556395595741071e-125 < z < 7.2321727432478166e-217

    1. Initial program 5.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}\]
    2. Simplified26.5

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.33334025156112373 \cdot 10^{199}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z} \cdot \frac{y}{c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{elif}\;z \le -8.3785659762865011 \cdot 10^{68}:\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - 4 \cdot \left(t \cdot a\right)\right) \cdot \frac{1}{c}\\ \mathbf{elif}\;z \le -2.55639559574107117 \cdot 10^{-125}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{elif}\;z \le 7.2321727432478166 \cdot 10^{-217}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot y}{z \cdot c}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;z \le 1.3341653186151825 \cdot 10^{189} \lor \neg \left(z \le 1.03779238211382713 \cdot 10^{252}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{c}}{z}, 9, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{t}{\sqrt[3]{c}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - 4 \cdot \left(t \cdot a\right)\right) \cdot \frac{1}{c}\\ \end{array}\]

Reproduce

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