Average Error: 20.5 → 9.1
Time: 22.3s
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}\;t \le -6.447875724562493603758107135164635941347 \cdot 10^{82}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{x \cdot y}{z \cdot c} \cdot 9\right) - \left(\left(a \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)\right) \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot 4\\ \mathbf{elif}\;t \le -3.482456241382053346718477681083412715225 \cdot 10^{-167}:\\ \;\;\;\;\left(9 \cdot \left(\frac{x}{z} \cdot \frac{y}{c}\right) + \frac{b}{z \cdot c}\right) - \frac{t \cdot a}{c} \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{x \cdot y}{z \cdot c} \cdot 9\right) - \left(\left(a \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)\right) \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\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}\;t \le -6.447875724562493603758107135164635941347 \cdot 10^{82}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + \frac{x \cdot y}{z \cdot c} \cdot 9\right) - \left(\left(a \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)\right) \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot 4\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r35047284 = x;
        double r35047285 = 9.0;
        double r35047286 = r35047284 * r35047285;
        double r35047287 = y;
        double r35047288 = r35047286 * r35047287;
        double r35047289 = z;
        double r35047290 = 4.0;
        double r35047291 = r35047289 * r35047290;
        double r35047292 = t;
        double r35047293 = r35047291 * r35047292;
        double r35047294 = a;
        double r35047295 = r35047293 * r35047294;
        double r35047296 = r35047288 - r35047295;
        double r35047297 = b;
        double r35047298 = r35047296 + r35047297;
        double r35047299 = c;
        double r35047300 = r35047289 * r35047299;
        double r35047301 = r35047298 / r35047300;
        return r35047301;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r35047302 = t;
        double r35047303 = -6.447875724562494e+82;
        bool r35047304 = r35047302 <= r35047303;
        double r35047305 = b;
        double r35047306 = z;
        double r35047307 = c;
        double r35047308 = r35047306 * r35047307;
        double r35047309 = r35047305 / r35047308;
        double r35047310 = x;
        double r35047311 = y;
        double r35047312 = r35047310 * r35047311;
        double r35047313 = r35047312 / r35047308;
        double r35047314 = 9.0;
        double r35047315 = r35047313 * r35047314;
        double r35047316 = r35047309 + r35047315;
        double r35047317 = a;
        double r35047318 = cbrt(r35047302);
        double r35047319 = cbrt(r35047307);
        double r35047320 = r35047318 / r35047319;
        double r35047321 = r35047320 * r35047320;
        double r35047322 = r35047317 * r35047321;
        double r35047323 = r35047322 * r35047320;
        double r35047324 = 4.0;
        double r35047325 = r35047323 * r35047324;
        double r35047326 = r35047316 - r35047325;
        double r35047327 = -3.482456241382053e-167;
        bool r35047328 = r35047302 <= r35047327;
        double r35047329 = r35047310 / r35047306;
        double r35047330 = r35047311 / r35047307;
        double r35047331 = r35047329 * r35047330;
        double r35047332 = r35047314 * r35047331;
        double r35047333 = r35047332 + r35047309;
        double r35047334 = r35047302 * r35047317;
        double r35047335 = r35047334 / r35047307;
        double r35047336 = r35047335 * r35047324;
        double r35047337 = r35047333 - r35047336;
        double r35047338 = r35047328 ? r35047337 : r35047326;
        double r35047339 = r35047304 ? r35047326 : r35047338;
        return r35047339;
}

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.5
Herbie9.1
\[\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 2 regimes
  2. if t < -6.447875724562494e+82 or -3.482456241382053e-167 < t

    1. Initial program 21.3

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

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

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

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

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

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

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

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

      \[\leadsto \left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \left(a \cdot \color{blue}{\left(\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)}\right)\]
    12. Applied associate-*r*8.7

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

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

    if -6.447875724562494e+82 < t < -3.482456241382053e-167

    1. Initial program 17.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -6.447875724562493603758107135164635941347 \cdot 10^{82}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{x \cdot y}{z \cdot c} \cdot 9\right) - \left(\left(a \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)\right) \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot 4\\ \mathbf{elif}\;t \le -3.482456241382053346718477681083412715225 \cdot 10^{-167}:\\ \;\;\;\;\left(9 \cdot \left(\frac{x}{z} \cdot \frac{y}{c}\right) + \frac{b}{z \cdot c}\right) - \frac{t \cdot a}{c} \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{x \cdot y}{z \cdot c} \cdot 9\right) - \left(\left(a \cdot \left(\frac{\sqrt[3]{t}}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right)\right) \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot 4\\ \end{array}\]

Reproduce

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