Average Error: 20.8 → 8.1
Time: 6.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}{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{\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{\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 r778444 = x;
        double r778445 = 9.0;
        double r778446 = r778444 * r778445;
        double r778447 = y;
        double r778448 = r778446 * r778447;
        double r778449 = z;
        double r778450 = 4.0;
        double r778451 = r778449 * r778450;
        double r778452 = t;
        double r778453 = r778451 * r778452;
        double r778454 = a;
        double r778455 = r778453 * r778454;
        double r778456 = r778448 - r778455;
        double r778457 = b;
        double r778458 = r778456 + r778457;
        double r778459 = c;
        double r778460 = r778449 * r778459;
        double r778461 = r778458 / r778460;
        return r778461;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r778462 = x;
        double r778463 = 9.0;
        double r778464 = r778462 * r778463;
        double r778465 = y;
        double r778466 = r778464 * r778465;
        double r778467 = z;
        double r778468 = 4.0;
        double r778469 = r778467 * r778468;
        double r778470 = t;
        double r778471 = r778469 * r778470;
        double r778472 = a;
        double r778473 = r778471 * r778472;
        double r778474 = r778466 - r778473;
        double r778475 = b;
        double r778476 = r778474 + r778475;
        double r778477 = c;
        double r778478 = r778467 * r778477;
        double r778479 = r778476 / r778478;
        double r778480 = -6.480977115387822e+67;
        bool r778481 = r778479 <= r778480;
        double r778482 = -r778468;
        double r778483 = r778472 / r778477;
        double r778484 = r778470 * r778483;
        double r778485 = r778463 * r778465;
        double r778486 = fma(r778462, r778485, r778475);
        double r778487 = r778486 / r778478;
        double r778488 = fma(r778482, r778484, r778487);
        double r778489 = 2.1409873178119e-20;
        bool r778490 = r778479 <= r778489;
        double r778491 = r778477 / r778472;
        double r778492 = r778470 / r778491;
        double r778493 = r778463 * r778462;
        double r778494 = fma(r778493, r778465, r778475);
        double r778495 = r778494 / r778467;
        double r778496 = r778495 / r778477;
        double r778497 = fma(r778482, r778492, r778496);
        double r778498 = 9.280953959187554e+306;
        bool r778499 = r778479 <= r778498;
        double r778500 = r778470 / r778477;
        double r778501 = r778500 * r778472;
        double r778502 = r778494 / r778477;
        double r778503 = r778502 / r778467;
        double r778504 = fma(r778482, r778501, r778503);
        double r778505 = r778499 ? r778479 : r778504;
        double r778506 = r778490 ? r778497 : r778505;
        double r778507 = r778481 ? r778488 : r778506;
        return r778507;
}

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 associate-*l/26.1

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

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

      \[\leadsto \mathsf{fma}\left(-4, \color{blue}{\frac{t}{c} \cdot a}, \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{\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)))