Average Error: 20.8 → 9.8
Time: 5.3s
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}\;x \cdot 9 \le -1036057109649567662362016612352:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;x \cdot 9 \le -6.89061031345223310472178690676714254187 \cdot 10^{-136}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;x \cdot 9 \le 6.688537818776959947786893985311265109188 \cdot 10^{-170}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{c} \cdot t\right)\\ \mathbf{elif}\;x \cdot 9 \le 0.002391614790233970513910755073538894066587:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \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}\;x \cdot 9 \le -1036057109649567662362016612352:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\

\mathbf{elif}\;x \cdot 9 \le -6.89061031345223310472178690676714254187 \cdot 10^{-136}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;x \cdot 9 \le 6.688537818776959947786893985311265109188 \cdot 10^{-170}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{c} \cdot t\right)\\

\mathbf{elif}\;x \cdot 9 \le 0.002391614790233970513910755073538894066587:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r812557 = x;
        double r812558 = 9.0;
        double r812559 = r812557 * r812558;
        double r812560 = y;
        double r812561 = r812559 * r812560;
        double r812562 = z;
        double r812563 = 4.0;
        double r812564 = r812562 * r812563;
        double r812565 = t;
        double r812566 = r812564 * r812565;
        double r812567 = a;
        double r812568 = r812566 * r812567;
        double r812569 = r812561 - r812568;
        double r812570 = b;
        double r812571 = r812569 + r812570;
        double r812572 = c;
        double r812573 = r812562 * r812572;
        double r812574 = r812571 / r812573;
        return r812574;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r812575 = x;
        double r812576 = 9.0;
        double r812577 = r812575 * r812576;
        double r812578 = -1.0360571096495677e+30;
        bool r812579 = r812577 <= r812578;
        double r812580 = b;
        double r812581 = z;
        double r812582 = c;
        double r812583 = r812581 * r812582;
        double r812584 = r812580 / r812583;
        double r812585 = y;
        double r812586 = r812583 / r812585;
        double r812587 = r812575 / r812586;
        double r812588 = r812576 * r812587;
        double r812589 = r812584 + r812588;
        double r812590 = 4.0;
        double r812591 = a;
        double r812592 = t;
        double r812593 = r812591 * r812592;
        double r812594 = r812593 / r812582;
        double r812595 = r812590 * r812594;
        double r812596 = r812589 - r812595;
        double r812597 = -6.890610313452233e-136;
        bool r812598 = r812577 <= r812597;
        double r812599 = r812575 * r812585;
        double r812600 = r812599 / r812581;
        double r812601 = r812600 / r812582;
        double r812602 = r812576 * r812601;
        double r812603 = r812584 + r812602;
        double r812604 = r812582 / r812592;
        double r812605 = r812591 / r812604;
        double r812606 = r812590 * r812605;
        double r812607 = r812603 - r812606;
        double r812608 = 6.68853781877696e-170;
        bool r812609 = r812577 <= r812608;
        double r812610 = r812599 / r812583;
        double r812611 = r812576 * r812610;
        double r812612 = r812584 + r812611;
        double r812613 = r812591 / r812582;
        double r812614 = r812613 * r812592;
        double r812615 = r812590 * r812614;
        double r812616 = r812612 - r812615;
        double r812617 = 0.0023916147902339705;
        bool r812618 = r812577 <= r812617;
        double r812619 = r812618 ? r812607 : r812596;
        double r812620 = r812609 ? r812616 : r812619;
        double r812621 = r812598 ? r812607 : r812620;
        double r812622 = r812579 ? r812596 : r812621;
        return r812622;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.8
Target14.4
Herbie9.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.100156740804105117061698089246936481893 \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 3 regimes
  2. if (* x 9.0) < -1.0360571096495677e+30 or 0.0023916147902339705 < (* x 9.0)

    1. Initial program 24.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. Taylor expanded around 0 17.1

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*11.9

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

    if -1.0360571096495677e+30 < (* x 9.0) < -6.890610313452233e-136 or 6.68853781877696e-170 < (* x 9.0) < 0.0023916147902339705

    1. Initial program 18.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. Taylor expanded around 0 7.9

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*7.4

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied associate-/r*8.6

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

    if -6.890610313452233e-136 < (* x 9.0) < 6.68853781877696e-170

    1. Initial program 17.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. Taylor expanded around 0 7.6

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*7.4

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied associate-/r/7.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 9 \le -1036057109649567662362016612352:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;x \cdot 9 \le -6.89061031345223310472178690676714254187 \cdot 10^{-136}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;x \cdot 9 \le 6.688537818776959947786893985311265109188 \cdot 10^{-170}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(\frac{a}{c} \cdot t\right)\\ \mathbf{elif}\;x \cdot 9 \le 0.002391614790233970513910755073538894066587:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x \cdot y}{z}}{c}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Reproduce

herbie shell --seed 2020001 
(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)))