Average Error: 20.3 → 5.4
Time: 27.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}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c \cdot z} \le -5.282824287712377491150945829093240061625 \cdot 10^{175}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c \cdot z} - 4 \cdot \left(t \cdot \frac{a}{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}{c \cdot z} \le 0.002363604832612245260775596378266527608503:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(9, y \cdot x, b\right)}{c}}{z} - 4 \cdot \frac{t \cdot a}{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}{c \cdot z} \le 4.40589149168671384163062716676752837828 \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}{c \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{c} \cdot \frac{x}{z}, 9, \frac{\frac{b}{z}}{c}\right) - \left(\frac{a}{\sqrt[3]{c}} \cdot \frac{\frac{t}{\sqrt[3]{c}}}{\sqrt[3]{c}}\right) \cdot 4\\ \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}{c \cdot z} \le -5.282824287712377491150945829093240061625 \cdot 10^{175}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c \cdot z} - 4 \cdot \left(t \cdot \frac{a}{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}{c \cdot z} \le 0.002363604832612245260775596378266527608503:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(9, y \cdot x, b\right)}{c}}{z} - 4 \cdot \frac{t \cdot a}{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}{c \cdot z} \le 4.40589149168671384163062716676752837828 \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}{c \cdot z}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r536622 = x;
        double r536623 = 9.0;
        double r536624 = r536622 * r536623;
        double r536625 = y;
        double r536626 = r536624 * r536625;
        double r536627 = z;
        double r536628 = 4.0;
        double r536629 = r536627 * r536628;
        double r536630 = t;
        double r536631 = r536629 * r536630;
        double r536632 = a;
        double r536633 = r536631 * r536632;
        double r536634 = r536626 - r536633;
        double r536635 = b;
        double r536636 = r536634 + r536635;
        double r536637 = c;
        double r536638 = r536627 * r536637;
        double r536639 = r536636 / r536638;
        return r536639;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r536640 = x;
        double r536641 = 9.0;
        double r536642 = r536640 * r536641;
        double r536643 = y;
        double r536644 = r536642 * r536643;
        double r536645 = z;
        double r536646 = 4.0;
        double r536647 = r536645 * r536646;
        double r536648 = t;
        double r536649 = r536647 * r536648;
        double r536650 = a;
        double r536651 = r536649 * r536650;
        double r536652 = r536644 - r536651;
        double r536653 = b;
        double r536654 = r536652 + r536653;
        double r536655 = c;
        double r536656 = r536655 * r536645;
        double r536657 = r536654 / r536656;
        double r536658 = -5.2828242877123775e+175;
        bool r536659 = r536657 <= r536658;
        double r536660 = r536643 * r536640;
        double r536661 = fma(r536660, r536641, r536653);
        double r536662 = r536661 / r536656;
        double r536663 = r536650 / r536655;
        double r536664 = r536648 * r536663;
        double r536665 = r536646 * r536664;
        double r536666 = r536662 - r536665;
        double r536667 = 0.0023636048326122453;
        bool r536668 = r536657 <= r536667;
        double r536669 = fma(r536641, r536660, r536653);
        double r536670 = r536669 / r536655;
        double r536671 = r536670 / r536645;
        double r536672 = r536648 * r536650;
        double r536673 = r536672 / r536655;
        double r536674 = r536646 * r536673;
        double r536675 = r536671 - r536674;
        double r536676 = 4.405891491686714e+307;
        bool r536677 = r536657 <= r536676;
        double r536678 = r536643 / r536655;
        double r536679 = r536640 / r536645;
        double r536680 = r536678 * r536679;
        double r536681 = r536653 / r536645;
        double r536682 = r536681 / r536655;
        double r536683 = fma(r536680, r536641, r536682);
        double r536684 = cbrt(r536655);
        double r536685 = r536650 / r536684;
        double r536686 = r536648 / r536684;
        double r536687 = r536686 / r536684;
        double r536688 = r536685 * r536687;
        double r536689 = r536688 * r536646;
        double r536690 = r536683 - r536689;
        double r536691 = r536677 ? r536657 : r536690;
        double r536692 = r536668 ? r536675 : r536691;
        double r536693 = r536659 ? r536666 : r536692;
        return r536693;
}

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.3
Target14.1
Herbie5.4
\[\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.100156740804104887233830094663413900721 \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)) < -5.2828242877123775e+175

    1. Initial program 27.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. Simplified22.2

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

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

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

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

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

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

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

    if -5.2828242877123775e+175 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 0.0023636048326122453

    1. Initial program 9.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. Simplified3.5

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

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

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

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

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

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

    if 0.0023636048326122453 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 4.405891491686714e+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 4.405891491686714e+307 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))

    1. Initial program 63.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. Simplified28.5

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

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

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

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

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

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

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

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

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

    \[\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}{c \cdot z} \le -5.282824287712377491150945829093240061625 \cdot 10^{175}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y \cdot x, 9, b\right)}{c \cdot z} - 4 \cdot \left(t \cdot \frac{a}{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}{c \cdot z} \le 0.002363604832612245260775596378266527608503:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(9, y \cdot x, b\right)}{c}}{z} - 4 \cdot \frac{t \cdot a}{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}{c \cdot z} \le 4.40589149168671384163062716676752837828 \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}{c \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{c} \cdot \frac{x}{z}, 9, \frac{\frac{b}{z}}{c}\right) - \left(\frac{a}{\sqrt[3]{c}} \cdot \frac{\frac{t}{\sqrt[3]{c}}}{\sqrt[3]{c}}\right) \cdot 4\\ \end{array}\]

Reproduce

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

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

  (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))