Average Error: 20.8 → 9.7
Time: 9.0s
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 -2.3946961746475826 \cdot 10^{35}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;z \le -5.2555164347572611 \cdot 10^{-282}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{elif}\;z \le 231759.4908422604:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{\sqrt[3]{t}}{\sqrt[3]{1}} \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{a}{\sqrt[3]{c}}\right)\right), \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\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}\;z \le -2.3946961746475826 \cdot 10^{35}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1462604 = x;
        double r1462605 = 9.0;
        double r1462606 = r1462604 * r1462605;
        double r1462607 = y;
        double r1462608 = r1462606 * r1462607;
        double r1462609 = z;
        double r1462610 = 4.0;
        double r1462611 = r1462609 * r1462610;
        double r1462612 = t;
        double r1462613 = r1462611 * r1462612;
        double r1462614 = a;
        double r1462615 = r1462613 * r1462614;
        double r1462616 = r1462608 - r1462615;
        double r1462617 = b;
        double r1462618 = r1462616 + r1462617;
        double r1462619 = c;
        double r1462620 = r1462609 * r1462619;
        double r1462621 = r1462618 / r1462620;
        return r1462621;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1462622 = z;
        double r1462623 = -2.3946961746475826e+35;
        bool r1462624 = r1462622 <= r1462623;
        double r1462625 = 4.0;
        double r1462626 = -r1462625;
        double r1462627 = t;
        double r1462628 = c;
        double r1462629 = a;
        double r1462630 = r1462628 / r1462629;
        double r1462631 = r1462627 / r1462630;
        double r1462632 = x;
        double r1462633 = 9.0;
        double r1462634 = y;
        double r1462635 = r1462633 * r1462634;
        double r1462636 = b;
        double r1462637 = fma(r1462632, r1462635, r1462636);
        double r1462638 = r1462622 * r1462628;
        double r1462639 = r1462637 / r1462638;
        double r1462640 = fma(r1462626, r1462631, r1462639);
        double r1462641 = -5.255516434757261e-282;
        bool r1462642 = r1462622 <= r1462641;
        double r1462643 = r1462627 * r1462629;
        double r1462644 = r1462643 / r1462628;
        double r1462645 = 1.0;
        double r1462646 = r1462645 / r1462622;
        double r1462647 = r1462633 * r1462632;
        double r1462648 = fma(r1462647, r1462634, r1462636);
        double r1462649 = r1462648 / r1462628;
        double r1462650 = r1462646 * r1462649;
        double r1462651 = fma(r1462626, r1462644, r1462650);
        double r1462652 = 231759.49084226042;
        bool r1462653 = r1462622 <= r1462652;
        double r1462654 = cbrt(r1462627);
        double r1462655 = cbrt(r1462645);
        double r1462656 = r1462654 / r1462655;
        double r1462657 = cbrt(r1462628);
        double r1462658 = r1462654 / r1462657;
        double r1462659 = r1462629 / r1462657;
        double r1462660 = r1462658 * r1462659;
        double r1462661 = r1462658 * r1462660;
        double r1462662 = r1462656 * r1462661;
        double r1462663 = fma(r1462626, r1462662, r1462639);
        double r1462664 = r1462648 / r1462622;
        double r1462665 = r1462664 / r1462628;
        double r1462666 = fma(r1462626, r1462644, r1462665);
        double r1462667 = r1462653 ? r1462663 : r1462666;
        double r1462668 = r1462642 ? r1462651 : r1462667;
        double r1462669 = r1462624 ? r1462640 : r1462668;
        return r1462669;
}

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
Herbie9.7
\[\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 < -2.3946961746475826e+35

    1. Initial program 32.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. Simplified14.1

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

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

    if -2.3946961746475826e+35 < z < -5.255516434757261e-282

    1. Initial program 7.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.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 *-un-lft-identity9.0

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

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

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

    if -5.255516434757261e-282 < z < 231759.49084226042

    1. Initial program 6.3

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

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

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

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

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

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

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

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

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

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

    if 231759.49084226042 < z

    1. Initial program 30.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. Simplified13.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-/r*8.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. Simplified8.9

      \[\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)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.3946961746475826 \cdot 10^{35}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{elif}\;z \le -5.2555164347572611 \cdot 10^{-282}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{elif}\;z \le 231759.4908422604:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{\sqrt[3]{t}}{\sqrt[3]{1}} \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{a}{\sqrt[3]{c}}\right)\right), \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \end{array}\]

Reproduce

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