Average Error: 20.9 → 8.8
Time: 11.1s
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 -1.77210810493644 \cdot 10^{-289}:\\ \;\;\;\;\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 1.83789508517328408 \cdot 10^{-26}:\\ \;\;\;\;\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.10864257768480395 \cdot 10^{275}:\\ \;\;\;\;\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{\mathsf{fma}\left(9, \frac{x \cdot y}{z}, \frac{b}{z}\right)}{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}\;\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.77210810493644 \cdot 10^{-289}:\\
\;\;\;\;\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 1.83789508517328408 \cdot 10^{-26}:\\
\;\;\;\;\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.10864257768480395 \cdot 10^{275}:\\
\;\;\;\;\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{\mathsf{fma}\left(9, \frac{x \cdot y}{z}, \frac{b}{z}\right)}{c}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r707669 = x;
        double r707670 = 9.0;
        double r707671 = r707669 * r707670;
        double r707672 = y;
        double r707673 = r707671 * r707672;
        double r707674 = z;
        double r707675 = 4.0;
        double r707676 = r707674 * r707675;
        double r707677 = t;
        double r707678 = r707676 * r707677;
        double r707679 = a;
        double r707680 = r707678 * r707679;
        double r707681 = r707673 - r707680;
        double r707682 = b;
        double r707683 = r707681 + r707682;
        double r707684 = c;
        double r707685 = r707674 * r707684;
        double r707686 = r707683 / r707685;
        return r707686;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r707687 = x;
        double r707688 = 9.0;
        double r707689 = r707687 * r707688;
        double r707690 = y;
        double r707691 = r707689 * r707690;
        double r707692 = z;
        double r707693 = 4.0;
        double r707694 = r707692 * r707693;
        double r707695 = t;
        double r707696 = r707694 * r707695;
        double r707697 = a;
        double r707698 = r707696 * r707697;
        double r707699 = r707691 - r707698;
        double r707700 = b;
        double r707701 = r707699 + r707700;
        double r707702 = c;
        double r707703 = r707692 * r707702;
        double r707704 = r707701 / r707703;
        double r707705 = -1.77210810493644e-289;
        bool r707706 = r707704 <= r707705;
        double r707707 = -r707693;
        double r707708 = r707695 * r707697;
        double r707709 = r707708 / r707702;
        double r707710 = r707687 * r707690;
        double r707711 = r707710 / r707703;
        double r707712 = r707700 / r707703;
        double r707713 = fma(r707688, r707711, r707712);
        double r707714 = fma(r707707, r707709, r707713);
        double r707715 = 1.837895085173284e-26;
        bool r707716 = r707704 <= r707715;
        double r707717 = r707702 / r707697;
        double r707718 = r707695 / r707717;
        double r707719 = r707688 * r707687;
        double r707720 = fma(r707719, r707690, r707700);
        double r707721 = r707720 / r707692;
        double r707722 = r707721 / r707702;
        double r707723 = fma(r707707, r707718, r707722);
        double r707724 = 1.108642577684804e+275;
        bool r707725 = r707704 <= r707724;
        double r707726 = r707710 / r707692;
        double r707727 = r707700 / r707692;
        double r707728 = fma(r707688, r707726, r707727);
        double r707729 = r707728 / r707702;
        double r707730 = fma(r707707, r707709, r707729);
        double r707731 = r707725 ? r707704 : r707730;
        double r707732 = r707716 ? r707723 : r707731;
        double r707733 = r707706 ? r707714 : r707732;
        return r707733;
}

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.9
Target15.0
Herbie8.8
\[\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)) < -1.77210810493644e-289

    1. Initial program 12.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. Simplified7.7

      \[\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*12.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. Simplified12.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)\]
    6. Using strategy rm
    7. Applied add-cube-cbrt13.5

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

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

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

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

      \[\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)\]
    12. Simplified7.6

      \[\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 -1.77210810493644e-289 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 1.837895085173284e-26

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

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

      \[\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*1.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 1.837895085173284e-26 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 1.108642577684804e+275

    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.108642577684804e+275 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))

    1. Initial program 57.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. Simplified28.2

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

      \[\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. Simplified26.3

      \[\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 26.2

      \[\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. Simplified26.2

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

    \[\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 -1.77210810493644 \cdot 10^{-289}:\\ \;\;\;\;\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 1.83789508517328408 \cdot 10^{-26}:\\ \;\;\;\;\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.10864257768480395 \cdot 10^{275}:\\ \;\;\;\;\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{\mathsf{fma}\left(9, \frac{x \cdot y}{z}, \frac{b}{z}\right)}{c}\right)\\ \end{array}\]

Reproduce

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