Average Error: 20.8 → 8.7
Time: 5.0s
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 r768679 = x;
        double r768680 = 9.0;
        double r768681 = r768679 * r768680;
        double r768682 = y;
        double r768683 = r768681 * r768682;
        double r768684 = z;
        double r768685 = 4.0;
        double r768686 = r768684 * r768685;
        double r768687 = t;
        double r768688 = r768686 * r768687;
        double r768689 = a;
        double r768690 = r768688 * r768689;
        double r768691 = r768683 - r768690;
        double r768692 = b;
        double r768693 = r768691 + r768692;
        double r768694 = c;
        double r768695 = r768684 * r768694;
        double r768696 = r768693 / r768695;
        return r768696;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r768697 = z;
        double r768698 = -1.618999810916643e+129;
        bool r768699 = r768697 <= r768698;
        double r768700 = b;
        double r768701 = c;
        double r768702 = r768697 * r768701;
        double r768703 = r768700 / r768702;
        double r768704 = 9.0;
        double r768705 = x;
        double r768706 = r768705 / r768697;
        double r768707 = r768704 * r768706;
        double r768708 = y;
        double r768709 = r768708 / r768701;
        double r768710 = r768707 * r768709;
        double r768711 = r768703 + r768710;
        double r768712 = 4.0;
        double r768713 = a;
        double r768714 = t;
        double r768715 = r768713 * r768714;
        double r768716 = r768715 / r768701;
        double r768717 = r768712 * r768716;
        double r768718 = r768711 - r768717;
        double r768719 = -2.6614597321448397e-235;
        bool r768720 = r768697 <= r768719;
        double r768721 = r768705 / r768702;
        double r768722 = r768721 * r768708;
        double r768723 = r768704 * r768722;
        double r768724 = r768703 + r768723;
        double r768725 = r768701 / r768714;
        double r768726 = r768713 / r768725;
        double r768727 = r768712 * r768726;
        double r768728 = r768724 - r768727;
        double r768729 = 3.6960054672565e+14;
        bool r768730 = r768697 <= r768729;
        double r768731 = 1.0;
        double r768732 = r768731 / r768697;
        double r768733 = r768705 * r768704;
        double r768734 = r768733 * r768708;
        double r768735 = r768697 * r768712;
        double r768736 = r768735 * r768714;
        double r768737 = r768736 * r768713;
        double r768738 = r768734 - r768737;
        double r768739 = r768738 + r768700;
        double r768740 = r768739 / r768701;
        double r768741 = r768732 * r768740;
        double r768742 = r768706 / r768701;
        double r768743 = r768742 * r768708;
        double r768744 = r768704 * r768743;
        double r768745 = r768703 + r768744;
        double r768746 = r768745 - r768717;
        double r768747 = r768730 ? r768741 : r768746;
        double r768748 = r768720 ? r768728 : r768747;
        double r768749 = r768699 ? r768718 : r768748;
        return r768749;
}

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)))