Average Error: 20.6 → 8.0
Time: 5.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 -8.80348621280553918 \cdot 10^{-41}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{z \cdot \frac{c}{y}}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \le 2.26419354811389004 \cdot 10^{-60}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\left(a \cdot t\right) \cdot \frac{1}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\frac{a}{\sqrt{c}} \cdot \frac{t}{\sqrt{c}}\right)\\ \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 -8.80348621280553918 \cdot 10^{-41}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{z \cdot \frac{c}{y}}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r657217 = x;
        double r657218 = 9.0;
        double r657219 = r657217 * r657218;
        double r657220 = y;
        double r657221 = r657219 * r657220;
        double r657222 = z;
        double r657223 = 4.0;
        double r657224 = r657222 * r657223;
        double r657225 = t;
        double r657226 = r657224 * r657225;
        double r657227 = a;
        double r657228 = r657226 * r657227;
        double r657229 = r657221 - r657228;
        double r657230 = b;
        double r657231 = r657229 + r657230;
        double r657232 = c;
        double r657233 = r657222 * r657232;
        double r657234 = r657231 / r657233;
        return r657234;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r657235 = c;
        double r657236 = -8.803486212805539e-41;
        bool r657237 = r657235 <= r657236;
        double r657238 = b;
        double r657239 = z;
        double r657240 = r657239 * r657235;
        double r657241 = r657238 / r657240;
        double r657242 = 9.0;
        double r657243 = x;
        double r657244 = y;
        double r657245 = r657235 / r657244;
        double r657246 = r657239 * r657245;
        double r657247 = r657243 / r657246;
        double r657248 = r657242 * r657247;
        double r657249 = r657241 + r657248;
        double r657250 = 4.0;
        double r657251 = a;
        double r657252 = t;
        double r657253 = r657252 / r657235;
        double r657254 = r657251 * r657253;
        double r657255 = r657250 * r657254;
        double r657256 = r657249 - r657255;
        double r657257 = 2.26419354811389e-60;
        bool r657258 = r657235 <= r657257;
        double r657259 = r657240 / r657244;
        double r657260 = r657243 / r657259;
        double r657261 = r657242 * r657260;
        double r657262 = r657241 + r657261;
        double r657263 = r657251 * r657252;
        double r657264 = 1.0;
        double r657265 = r657264 / r657235;
        double r657266 = r657263 * r657265;
        double r657267 = r657250 * r657266;
        double r657268 = r657262 - r657267;
        double r657269 = sqrt(r657235);
        double r657270 = r657251 / r657269;
        double r657271 = r657252 / r657269;
        double r657272 = r657270 * r657271;
        double r657273 = r657250 * r657272;
        double r657274 = r657262 - r657273;
        double r657275 = r657258 ? r657268 : r657274;
        double r657276 = r657237 ? r657256 : r657275;
        return r657276;
}

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.6
Target14.9
Herbie8.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.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 3 regimes
  2. if c < -8.803486212805539e-41

    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. Taylor expanded around 0 14.1

      \[\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.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 *-un-lft-identity12.6

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

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

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

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

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

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

    if -8.803486212805539e-41 < c < 2.26419354811389e-60

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

      \[\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*7.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 div-inv7.8

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

    if 2.26419354811389e-60 < c

    1. Initial program 21.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*12.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 add-sqr-sqrt12.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -8.80348621280553918 \cdot 10^{-41}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{z \cdot \frac{c}{y}}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \le 2.26419354811389004 \cdot 10^{-60}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\left(a \cdot t\right) \cdot \frac{1}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(\frac{a}{\sqrt{c}} \cdot \frac{t}{\sqrt{c}}\right)\\ \end{array}\]

Reproduce

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