Average Error: 20.5 → 10.9
Time: 15.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 -5.602555203160424923167523792835860188698 \cdot 10^{206} \lor \left(z \le -2017164749410712516555968178703810166784 \lor \neg \left(z \le 1.155843648897636062458564271484047200646 \cdot 10^{99}\right)\right):\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{c}}{z}\\ \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 -5.602555203160424923167523792835860188698 \cdot 10^{206} \lor \left(z \le -2017164749410712516555968178703810166784 \lor \neg \left(z \le 1.155843648897636062458564271484047200646 \cdot 10^{99}\right)\right):\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r564466 = x;
        double r564467 = 9.0;
        double r564468 = r564466 * r564467;
        double r564469 = y;
        double r564470 = r564468 * r564469;
        double r564471 = z;
        double r564472 = 4.0;
        double r564473 = r564471 * r564472;
        double r564474 = t;
        double r564475 = r564473 * r564474;
        double r564476 = a;
        double r564477 = r564475 * r564476;
        double r564478 = r564470 - r564477;
        double r564479 = b;
        double r564480 = r564478 + r564479;
        double r564481 = c;
        double r564482 = r564471 * r564481;
        double r564483 = r564480 / r564482;
        return r564483;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r564484 = z;
        double r564485 = -5.602555203160425e+206;
        bool r564486 = r564484 <= r564485;
        double r564487 = -2.0171647494107125e+39;
        bool r564488 = r564484 <= r564487;
        double r564489 = 1.155843648897636e+99;
        bool r564490 = r564484 <= r564489;
        double r564491 = !r564490;
        bool r564492 = r564488 || r564491;
        bool r564493 = r564486 || r564492;
        double r564494 = b;
        double r564495 = r564494 / r564484;
        double r564496 = c;
        double r564497 = r564495 / r564496;
        double r564498 = 9.0;
        double r564499 = x;
        double r564500 = y;
        double r564501 = r564499 * r564500;
        double r564502 = r564484 * r564496;
        double r564503 = r564501 / r564502;
        double r564504 = r564498 * r564503;
        double r564505 = r564497 + r564504;
        double r564506 = 4.0;
        double r564507 = a;
        double r564508 = t;
        double r564509 = r564508 / r564496;
        double r564510 = r564507 * r564509;
        double r564511 = r564506 * r564510;
        double r564512 = r564505 - r564511;
        double r564513 = r564499 * r564498;
        double r564514 = r564513 * r564500;
        double r564515 = r564484 * r564506;
        double r564516 = r564515 * r564508;
        double r564517 = r564516 * r564507;
        double r564518 = r564514 - r564517;
        double r564519 = r564518 + r564494;
        double r564520 = r564519 / r564496;
        double r564521 = r564520 / r564484;
        double r564522 = r564493 ? r564512 : r564521;
        return r564522;
}

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.7
Herbie10.9
\[\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 z < -5.602555203160425e+206

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

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

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

      \[\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 -5.602555203160425e+206 < z < -2.0171647494107125e+39

    1. Initial program 25.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 13.4

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

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

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

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

    if -2.0171647494107125e+39 < z < 1.155843648897636e+99

    1. Initial program 8.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. Using strategy rm
    3. Applied *-un-lft-identity8.7

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

      \[\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 1.155843648897636e+99 < z

    1. Initial program 35.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. Taylor expanded around 0 13.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 *-un-lft-identity13.6

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

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

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

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

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

Reproduce

herbie shell --seed 2019298 
(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.1001567408041049e-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.17088779117474882e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.8768236795461372e130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e158) (/ (+ (- (* (* 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)))