Average Error: 20.3 → 8.6
Time: 20.5s
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}\;c \le -1.625085631543358732320091442568527876321 \cdot 10^{236}:\\ \;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{elif}\;c \le -3.219989311472562902672852908856520561797 \cdot 10^{72}:\\ \;\;\;\;\frac{\frac{1}{z}}{c} \cdot \left(b + 9 \cdot \left(x \cdot y\right)\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{elif}\;c \le 8290210019565755392:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} - \left(a \cdot 4\right) \cdot t}{c}\\ \mathbf{elif}\;c \le 2.90172623420447656916768980270529670433 \cdot 10^{112}:\\ \;\;\;\;\left(\frac{x \cdot 9}{z} \cdot \frac{y}{c} + \frac{\frac{b}{z}}{c}\right) - \left(t \cdot \frac{a}{c}\right) \cdot 4\\ \mathbf{elif}\;c \le 5.384874907132591742260898291657963068611 \cdot 10^{119} \lor \neg \left(c \le 3.007660958277424467054697443275071305009 \cdot 10^{239}\right):\\ \;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z}}{c} \cdot \left(b + 9 \cdot \left(x \cdot y\right)\right) - \frac{t}{\frac{c}{a}} \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}\;c \le -1.625085631543358732320091442568527876321 \cdot 10^{236}:\\
\;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\

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

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

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

\mathbf{elif}\;c \le 5.384874907132591742260898291657963068611 \cdot 10^{119} \lor \neg \left(c \le 3.007660958277424467054697443275071305009 \cdot 10^{239}\right):\\
\;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1200068 = x;
        double r1200069 = 9.0;
        double r1200070 = r1200068 * r1200069;
        double r1200071 = y;
        double r1200072 = r1200070 * r1200071;
        double r1200073 = z;
        double r1200074 = 4.0;
        double r1200075 = r1200073 * r1200074;
        double r1200076 = t;
        double r1200077 = r1200075 * r1200076;
        double r1200078 = a;
        double r1200079 = r1200077 * r1200078;
        double r1200080 = r1200072 - r1200079;
        double r1200081 = b;
        double r1200082 = r1200080 + r1200081;
        double r1200083 = c;
        double r1200084 = r1200073 * r1200083;
        double r1200085 = r1200082 / r1200084;
        return r1200085;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1200086 = c;
        double r1200087 = -1.6250856315433587e+236;
        bool r1200088 = r1200086 <= r1200087;
        double r1200089 = b;
        double r1200090 = r1200089 / r1200086;
        double r1200091 = z;
        double r1200092 = r1200090 / r1200091;
        double r1200093 = x;
        double r1200094 = 9.0;
        double r1200095 = r1200093 * r1200094;
        double r1200096 = y;
        double r1200097 = r1200096 / r1200091;
        double r1200098 = r1200086 / r1200097;
        double r1200099 = r1200095 / r1200098;
        double r1200100 = r1200092 + r1200099;
        double r1200101 = t;
        double r1200102 = a;
        double r1200103 = r1200086 / r1200102;
        double r1200104 = r1200101 / r1200103;
        double r1200105 = 4.0;
        double r1200106 = r1200104 * r1200105;
        double r1200107 = r1200100 - r1200106;
        double r1200108 = -3.219989311472563e+72;
        bool r1200109 = r1200086 <= r1200108;
        double r1200110 = 1.0;
        double r1200111 = r1200110 / r1200091;
        double r1200112 = r1200111 / r1200086;
        double r1200113 = r1200093 * r1200096;
        double r1200114 = r1200094 * r1200113;
        double r1200115 = r1200089 + r1200114;
        double r1200116 = r1200112 * r1200115;
        double r1200117 = r1200116 - r1200106;
        double r1200118 = 8.290210019565755e+18;
        bool r1200119 = r1200086 <= r1200118;
        double r1200120 = r1200095 * r1200096;
        double r1200121 = r1200120 + r1200089;
        double r1200122 = r1200121 / r1200091;
        double r1200123 = r1200102 * r1200105;
        double r1200124 = r1200123 * r1200101;
        double r1200125 = r1200122 - r1200124;
        double r1200126 = r1200125 / r1200086;
        double r1200127 = 2.9017262342044766e+112;
        bool r1200128 = r1200086 <= r1200127;
        double r1200129 = r1200095 / r1200091;
        double r1200130 = r1200096 / r1200086;
        double r1200131 = r1200129 * r1200130;
        double r1200132 = r1200089 / r1200091;
        double r1200133 = r1200132 / r1200086;
        double r1200134 = r1200131 + r1200133;
        double r1200135 = r1200102 / r1200086;
        double r1200136 = r1200101 * r1200135;
        double r1200137 = r1200136 * r1200105;
        double r1200138 = r1200134 - r1200137;
        double r1200139 = 5.384874907132592e+119;
        bool r1200140 = r1200086 <= r1200139;
        double r1200141 = 3.0076609582774245e+239;
        bool r1200142 = r1200086 <= r1200141;
        double r1200143 = !r1200142;
        bool r1200144 = r1200140 || r1200143;
        double r1200145 = r1200144 ? r1200107 : r1200117;
        double r1200146 = r1200128 ? r1200138 : r1200145;
        double r1200147 = r1200119 ? r1200126 : r1200146;
        double r1200148 = r1200109 ? r1200117 : r1200147;
        double r1200149 = r1200088 ? r1200107 : r1200148;
        return r1200149;
}

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.3
Target14.1
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.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 4 regimes
  2. if c < -1.6250856315433587e+236 or 2.9017262342044766e+112 < c < 5.384874907132592e+119 or 3.0076609582774245e+239 < c

    1. Initial program 27.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. Simplified23.8

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

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

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

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

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

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

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

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

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

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

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

    if -1.6250856315433587e+236 < c < -3.219989311472563e+72 or 5.384874907132592e+119 < c < 3.0076609582774245e+239

    1. Initial program 22.9

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{b + \left(y \cdot x\right) \cdot 9}{z \cdot c} - \color{blue}{\frac{t}{\frac{c}{a}}} \cdot 4\]
    13. Using strategy rm
    14. Applied div-inv11.7

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

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

    if -3.219989311472563e+72 < c < 8.290210019565755e+18

    1. Initial program 15.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. Simplified4.3

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

    if 8.290210019565755e+18 < c < 2.9017262342044766e+112

    1. Initial program 18.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. Simplified11.7

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -1.625085631543358732320091442568527876321 \cdot 10^{236}:\\ \;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{elif}\;c \le -3.219989311472562902672852908856520561797 \cdot 10^{72}:\\ \;\;\;\;\frac{\frac{1}{z}}{c} \cdot \left(b + 9 \cdot \left(x \cdot y\right)\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{elif}\;c \le 8290210019565755392:\\ \;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} - \left(a \cdot 4\right) \cdot t}{c}\\ \mathbf{elif}\;c \le 2.90172623420447656916768980270529670433 \cdot 10^{112}:\\ \;\;\;\;\left(\frac{x \cdot 9}{z} \cdot \frac{y}{c} + \frac{\frac{b}{z}}{c}\right) - \left(t \cdot \frac{a}{c}\right) \cdot 4\\ \mathbf{elif}\;c \le 5.384874907132591742260898291657963068611 \cdot 10^{119} \lor \neg \left(c \le 3.007660958277424467054697443275071305009 \cdot 10^{239}\right):\\ \;\;\;\;\left(\frac{\frac{b}{c}}{z} + \frac{x \cdot 9}{\frac{c}{\frac{y}{z}}}\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z}}{c} \cdot \left(b + 9 \cdot \left(x \cdot y\right)\right) - \frac{t}{\frac{c}{a}} \cdot 4\\ \end{array}\]

Reproduce

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