Average Error: 20.4 → 8.6
Time: 5.6s
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 -107.9477164565985418676064000464975833893 \lor \neg \left(z \le 4.089116712204728111103095377557020347435 \cdot 10^{58}\right):\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{\frac{x}{z}}{c}}{\frac{1}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x}{z \cdot c}}{\frac{1}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \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 -107.9477164565985418676064000464975833893 \lor \neg \left(z \le 4.089116712204728111103095377557020347435 \cdot 10^{58}\right):\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{\frac{x}{z}}{c}}{\frac{1}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1004677 = x;
        double r1004678 = 9.0;
        double r1004679 = r1004677 * r1004678;
        double r1004680 = y;
        double r1004681 = r1004679 * r1004680;
        double r1004682 = z;
        double r1004683 = 4.0;
        double r1004684 = r1004682 * r1004683;
        double r1004685 = t;
        double r1004686 = r1004684 * r1004685;
        double r1004687 = a;
        double r1004688 = r1004686 * r1004687;
        double r1004689 = r1004681 - r1004688;
        double r1004690 = b;
        double r1004691 = r1004689 + r1004690;
        double r1004692 = c;
        double r1004693 = r1004682 * r1004692;
        double r1004694 = r1004691 / r1004693;
        return r1004694;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1004695 = z;
        double r1004696 = -107.94771645659854;
        bool r1004697 = r1004695 <= r1004696;
        double r1004698 = 4.089116712204728e+58;
        bool r1004699 = r1004695 <= r1004698;
        double r1004700 = !r1004699;
        bool r1004701 = r1004697 || r1004700;
        double r1004702 = b;
        double r1004703 = c;
        double r1004704 = r1004695 * r1004703;
        double r1004705 = r1004702 / r1004704;
        double r1004706 = 9.0;
        double r1004707 = x;
        double r1004708 = r1004707 / r1004695;
        double r1004709 = r1004708 / r1004703;
        double r1004710 = 1.0;
        double r1004711 = y;
        double r1004712 = r1004710 / r1004711;
        double r1004713 = r1004709 / r1004712;
        double r1004714 = r1004706 * r1004713;
        double r1004715 = r1004705 + r1004714;
        double r1004716 = 4.0;
        double r1004717 = a;
        double r1004718 = t;
        double r1004719 = r1004717 * r1004718;
        double r1004720 = r1004719 / r1004703;
        double r1004721 = r1004716 * r1004720;
        double r1004722 = r1004715 - r1004721;
        double r1004723 = r1004707 / r1004704;
        double r1004724 = r1004723 / r1004712;
        double r1004725 = r1004706 * r1004724;
        double r1004726 = r1004705 + r1004725;
        double r1004727 = r1004703 / r1004718;
        double r1004728 = r1004717 / r1004727;
        double r1004729 = r1004716 * r1004728;
        double r1004730 = r1004726 - r1004729;
        double r1004731 = r1004701 ? r1004722 : r1004730;
        return r1004731;
}

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.4
Target15.0
Herbie8.6
\[\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 2 regimes
  2. if z < -107.94771645659854 or 4.089116712204728e+58 < z

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

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

      \[\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 div-inv11.7

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

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

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

    if -107.94771645659854 < z < 4.089116712204728e+58

    1. Initial program 7.2

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

      \[\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 div-inv10.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -107.9477164565985418676064000464975833893 \lor \neg \left(z \le 4.089116712204728111103095377557020347435 \cdot 10^{58}\right):\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{\frac{x}{z}}{c}}{\frac{1}{y}}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{\frac{x}{z \cdot c}}{\frac{1}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]

Reproduce

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