Average Error: 20.8 → 8.7
Time: 4.9s
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 -1.6189998109166429 \cdot 10^{129}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \left(9 \cdot \frac{x}{z}\right) \cdot \frac{y}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -2.66145973214483969 \cdot 10^{-235}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 369600546725650:\\ \;\;\;\;\frac{1}{z} \cdot \frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\frac{x}{z}}{c} \cdot y\right)\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}\;z \le -1.6189998109166429 \cdot 10^{129}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + \left(9 \cdot \frac{x}{z}\right) \cdot \frac{y}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\

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

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

\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\frac{x}{z}}{c} \cdot y\right)\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 r787522 = x;
        double r787523 = 9.0;
        double r787524 = r787522 * r787523;
        double r787525 = y;
        double r787526 = r787524 * r787525;
        double r787527 = z;
        double r787528 = 4.0;
        double r787529 = r787527 * r787528;
        double r787530 = t;
        double r787531 = r787529 * r787530;
        double r787532 = a;
        double r787533 = r787531 * r787532;
        double r787534 = r787526 - r787533;
        double r787535 = b;
        double r787536 = r787534 + r787535;
        double r787537 = c;
        double r787538 = r787527 * r787537;
        double r787539 = r787536 / r787538;
        return r787539;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r787540 = z;
        double r787541 = -1.618999810916643e+129;
        bool r787542 = r787540 <= r787541;
        double r787543 = b;
        double r787544 = c;
        double r787545 = r787540 * r787544;
        double r787546 = r787543 / r787545;
        double r787547 = 9.0;
        double r787548 = x;
        double r787549 = r787548 / r787540;
        double r787550 = r787547 * r787549;
        double r787551 = y;
        double r787552 = r787551 / r787544;
        double r787553 = r787550 * r787552;
        double r787554 = r787546 + r787553;
        double r787555 = 4.0;
        double r787556 = a;
        double r787557 = t;
        double r787558 = r787556 * r787557;
        double r787559 = r787558 / r787544;
        double r787560 = r787555 * r787559;
        double r787561 = r787554 - r787560;
        double r787562 = -2.6614597321448397e-235;
        bool r787563 = r787540 <= r787562;
        double r787564 = r787548 / r787545;
        double r787565 = r787564 * r787551;
        double r787566 = r787547 * r787565;
        double r787567 = r787546 + r787566;
        double r787568 = r787544 / r787557;
        double r787569 = r787556 / r787568;
        double r787570 = r787555 * r787569;
        double r787571 = r787567 - r787570;
        double r787572 = 3.6960054672565e+14;
        bool r787573 = r787540 <= r787572;
        double r787574 = 1.0;
        double r787575 = r787574 / r787540;
        double r787576 = r787548 * r787547;
        double r787577 = r787576 * r787551;
        double r787578 = r787540 * r787555;
        double r787579 = r787578 * r787557;
        double r787580 = r787579 * r787556;
        double r787581 = r787577 - r787580;
        double r787582 = r787581 + r787543;
        double r787583 = r787582 / r787544;
        double r787584 = r787575 * r787583;
        double r787585 = r787549 / r787544;
        double r787586 = r787585 * r787551;
        double r787587 = r787547 * r787586;
        double r787588 = r787546 + r787587;
        double r787589 = r787588 - r787560;
        double r787590 = r787573 ? r787584 : r787589;
        double r787591 = r787563 ? r787571 : r787590;
        double r787592 = r787542 ? r787561 : r787591;
        return r787592;
}

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.8
Herbie8.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 < -1.618999810916643e+129

    1. Initial program 37.4

      \[\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 15.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 times-frac11.4

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

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

    if -1.618999810916643e+129 < z < -2.6614597321448397e-235

    1. Initial program 11.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. Taylor expanded around 0 9.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*9.8

      \[\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}\]
    5. Using strategy rm
    6. Applied associate-/r/10.1

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

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

    if -2.6614597321448397e-235 < z < 3.6960054672565e+14

    1. Initial program 6.4

      \[\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. Using strategy rm
    3. Applied *-un-lft-identity6.4

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

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

    if 3.6960054672565e+14 < z

    1. Initial program 31.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 14.7

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

      \[\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}\]
    5. Using strategy rm
    6. Applied associate-/r/12.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.6189998109166429 \cdot 10^{129}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \left(9 \cdot \frac{x}{z}\right) \cdot \frac{y}{c}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;z \le -2.66145973214483969 \cdot 10^{-235}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;z \le 369600546725650:\\ \;\;\;\;\frac{1}{z} \cdot \frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\frac{x}{z}}{c} \cdot y\right)\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Reproduce

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