Average Error: 20.8 → 8.1
Time: 6.8s
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 -6.480977115387822 \cdot 10^{67}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot 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 2.1409873178118999 \cdot 10^{-20}:\\ \;\;\;\;\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 9.28095395918755376 \cdot 10^{306}:\\ \;\;\;\;\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}{c} \cdot a, \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}}{z}\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 -6.480977115387822 \cdot 10^{67}:\\
\;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot 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 2.1409873178118999 \cdot 10^{-20}:\\
\;\;\;\;\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 9.28095395918755376 \cdot 10^{306}:\\
\;\;\;\;\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}{c} \cdot a, \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}}{z}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r780218 = x;
        double r780219 = 9.0;
        double r780220 = r780218 * r780219;
        double r780221 = y;
        double r780222 = r780220 * r780221;
        double r780223 = z;
        double r780224 = 4.0;
        double r780225 = r780223 * r780224;
        double r780226 = t;
        double r780227 = r780225 * r780226;
        double r780228 = a;
        double r780229 = r780227 * r780228;
        double r780230 = r780222 - r780229;
        double r780231 = b;
        double r780232 = r780230 + r780231;
        double r780233 = c;
        double r780234 = r780223 * r780233;
        double r780235 = r780232 / r780234;
        return r780235;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r780236 = x;
        double r780237 = 9.0;
        double r780238 = r780236 * r780237;
        double r780239 = y;
        double r780240 = r780238 * r780239;
        double r780241 = z;
        double r780242 = 4.0;
        double r780243 = r780241 * r780242;
        double r780244 = t;
        double r780245 = r780243 * r780244;
        double r780246 = a;
        double r780247 = r780245 * r780246;
        double r780248 = r780240 - r780247;
        double r780249 = b;
        double r780250 = r780248 + r780249;
        double r780251 = c;
        double r780252 = r780241 * r780251;
        double r780253 = r780250 / r780252;
        double r780254 = -6.480977115387822e+67;
        bool r780255 = r780253 <= r780254;
        double r780256 = -r780242;
        double r780257 = r780246 / r780251;
        double r780258 = r780244 * r780257;
        double r780259 = r780237 * r780239;
        double r780260 = fma(r780236, r780259, r780249);
        double r780261 = r780260 / r780252;
        double r780262 = fma(r780256, r780258, r780261);
        double r780263 = 2.1409873178119e-20;
        bool r780264 = r780253 <= r780263;
        double r780265 = r780251 / r780246;
        double r780266 = r780244 / r780265;
        double r780267 = r780237 * r780236;
        double r780268 = fma(r780267, r780239, r780249);
        double r780269 = r780268 / r780241;
        double r780270 = r780269 / r780251;
        double r780271 = fma(r780256, r780266, r780270);
        double r780272 = 9.280953959187554e+306;
        bool r780273 = r780253 <= r780272;
        double r780274 = r780244 / r780251;
        double r780275 = r780274 * r780246;
        double r780276 = 1.0;
        double r780277 = cbrt(r780276);
        double r780278 = r780277 * r780277;
        double r780279 = r780278 / r780276;
        double r780280 = r780268 / r780251;
        double r780281 = r780280 / r780241;
        double r780282 = r780279 * r780281;
        double r780283 = fma(r780256, r780275, r780282);
        double r780284 = r780273 ? r780253 : r780283;
        double r780285 = r780264 ? r780271 : r780284;
        double r780286 = r780255 ? r780262 : r780285;
        return r780286;
}

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.9
Herbie8.1
\[\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)) < -6.480977115387822e+67

    1. Initial program 19.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. Simplified12.5

      \[\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-identity12.5

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

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

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

    if -6.480977115387822e+67 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 2.1409873178119e-20

    1. Initial program 12.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}\]
    2. Simplified8.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-/l*9.5

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

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

      \[\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 2.1409873178119e-20 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 9.280953959187554e+306

    1. Initial program 0.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}\]

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

    1. Initial program 63.9

      \[\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. Simplified31.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-/l*28.2

      \[\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 *-un-lft-identity28.2

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \color{blue}{\frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}}{z}}\right)\]
    15. Using strategy rm
    16. Applied associate-/r/23.6

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

    \[\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 -6.480977115387822 \cdot 10^{67}:\\ \;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot 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 2.1409873178118999 \cdot 10^{-20}:\\ \;\;\;\;\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 9.28095395918755376 \cdot 10^{306}:\\ \;\;\;\;\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}{c} \cdot a, \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}}{z}\right)\\ \end{array}\]

Reproduce

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