Average Error: 20.5 → 6.0
Time: 53.2s
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{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le -2.28298144243635429750975635929884797855 \cdot 10^{112}:\\ \;\;\;\;\left(\frac{1}{\frac{c \cdot z}{b}} + 9 \cdot \frac{x}{\frac{c \cdot z}{y}}\right) - \left(\frac{a}{c} \cdot t\right) \cdot 4\\ \mathbf{elif}\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le 4.09973230378698016031405356379068580905 \cdot 10^{-73}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{\left(9 \cdot x\right) \cdot y + b}{z} - 4 \cdot \left(a \cdot t\right)}}\\ \mathbf{elif}\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le 1.676513492778132650506503414162823386727 \cdot 10^{303}:\\ \;\;\;\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\frac{c \cdot z}{b}} + 9 \cdot \frac{x}{\frac{c \cdot z}{y}}\right) - \left(\frac{a}{c} \cdot t\right) \cdot 4\\ \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{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le -2.28298144243635429750975635929884797855 \cdot 10^{112}:\\
\;\;\;\;\left(\frac{1}{\frac{c \cdot z}{b}} + 9 \cdot \frac{x}{\frac{c \cdot z}{y}}\right) - \left(\frac{a}{c} \cdot t\right) \cdot 4\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r32471734 = x;
        double r32471735 = 9.0;
        double r32471736 = r32471734 * r32471735;
        double r32471737 = y;
        double r32471738 = r32471736 * r32471737;
        double r32471739 = z;
        double r32471740 = 4.0;
        double r32471741 = r32471739 * r32471740;
        double r32471742 = t;
        double r32471743 = r32471741 * r32471742;
        double r32471744 = a;
        double r32471745 = r32471743 * r32471744;
        double r32471746 = r32471738 - r32471745;
        double r32471747 = b;
        double r32471748 = r32471746 + r32471747;
        double r32471749 = c;
        double r32471750 = r32471739 * r32471749;
        double r32471751 = r32471748 / r32471750;
        return r32471751;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r32471752 = b;
        double r32471753 = 9.0;
        double r32471754 = x;
        double r32471755 = r32471753 * r32471754;
        double r32471756 = y;
        double r32471757 = r32471755 * r32471756;
        double r32471758 = t;
        double r32471759 = z;
        double r32471760 = 4.0;
        double r32471761 = r32471759 * r32471760;
        double r32471762 = r32471758 * r32471761;
        double r32471763 = a;
        double r32471764 = r32471762 * r32471763;
        double r32471765 = r32471757 - r32471764;
        double r32471766 = r32471752 + r32471765;
        double r32471767 = c;
        double r32471768 = r32471767 * r32471759;
        double r32471769 = r32471766 / r32471768;
        double r32471770 = -2.2829814424363543e+112;
        bool r32471771 = r32471769 <= r32471770;
        double r32471772 = 1.0;
        double r32471773 = r32471768 / r32471752;
        double r32471774 = r32471772 / r32471773;
        double r32471775 = r32471768 / r32471756;
        double r32471776 = r32471754 / r32471775;
        double r32471777 = r32471753 * r32471776;
        double r32471778 = r32471774 + r32471777;
        double r32471779 = r32471763 / r32471767;
        double r32471780 = r32471779 * r32471758;
        double r32471781 = r32471780 * r32471760;
        double r32471782 = r32471778 - r32471781;
        double r32471783 = 4.09973230378698e-73;
        bool r32471784 = r32471769 <= r32471783;
        double r32471785 = r32471757 + r32471752;
        double r32471786 = r32471785 / r32471759;
        double r32471787 = r32471763 * r32471758;
        double r32471788 = r32471760 * r32471787;
        double r32471789 = r32471786 - r32471788;
        double r32471790 = r32471767 / r32471789;
        double r32471791 = r32471772 / r32471790;
        double r32471792 = 1.6765134927781327e+303;
        bool r32471793 = r32471769 <= r32471792;
        double r32471794 = r32471793 ? r32471769 : r32471782;
        double r32471795 = r32471784 ? r32471791 : r32471794;
        double r32471796 = r32471771 ? r32471782 : r32471795;
        return r32471796;
}

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.5
Target14.2
Herbie6.0
\[\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.100156740804104887233830094663413900721 \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) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -2.2829814424363543e+112 or 1.6765134927781327e+303 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))

    1. Initial program 41.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. Simplified23.3

      \[\leadsto \color{blue}{\frac{\frac{\left(9 \cdot x\right) \cdot y + b}{z} - \left(a \cdot t\right) \cdot 4}{c}}\]
    3. Taylor expanded around 0 21.2

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

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}\right) - 4 \cdot \frac{t \cdot a}{c}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity15.7

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

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

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\color{blue}{t} \cdot \frac{a}{c}\right)\]
    10. Using strategy rm
    11. Applied clear-num12.2

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

    if -2.2829814424363543e+112 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 4.09973230378698e-73

    1. Initial program 12.0

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

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

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

    if 4.09973230378698e-73 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 1.6765134927781327e+303

    1. Initial program 0.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}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le -2.28298144243635429750975635929884797855 \cdot 10^{112}:\\ \;\;\;\;\left(\frac{1}{\frac{c \cdot z}{b}} + 9 \cdot \frac{x}{\frac{c \cdot z}{y}}\right) - \left(\frac{a}{c} \cdot t\right) \cdot 4\\ \mathbf{elif}\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le 4.09973230378698016031405356379068580905 \cdot 10^{-73}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{\left(9 \cdot x\right) \cdot y + b}{z} - 4 \cdot \left(a \cdot t\right)}}\\ \mathbf{elif}\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z} \le 1.676513492778132650506503414162823386727 \cdot 10^{303}:\\ \;\;\;\;\frac{b + \left(\left(9 \cdot x\right) \cdot y - \left(t \cdot \left(z \cdot 4\right)\right) \cdot a\right)}{c \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\frac{c \cdot z}{b}} + 9 \cdot \frac{x}{\frac{c \cdot z}{y}}\right) - \left(\frac{a}{c} \cdot t\right) \cdot 4\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"

  :herbie-target
  (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.100156740804105e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))