Average Error: 20.0 → 8.0
Time: 19.5s
Precision: 64
\[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;c \le -9.889141936680343 \cdot 10^{+123}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 1.3927288177737055 \cdot 10^{-179}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{y \cdot \left(9.0 \cdot x\right) + b}} - a \cdot \left(4.0 \cdot t\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4.0 \cdot \frac{\frac{a}{c}}{\frac{1}{t}}\\ \end{array}\]
\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;c \le -9.889141936680343 \cdot 10^{+123}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;c \le 1.3927288177737055 \cdot 10^{-179}:\\
\;\;\;\;\frac{\frac{1}{\frac{z}{y \cdot \left(9.0 \cdot x\right) + b}} - a \cdot \left(4.0 \cdot t\right)}{c}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r34029380 = x;
        double r34029381 = 9.0;
        double r34029382 = r34029380 * r34029381;
        double r34029383 = y;
        double r34029384 = r34029382 * r34029383;
        double r34029385 = z;
        double r34029386 = 4.0;
        double r34029387 = r34029385 * r34029386;
        double r34029388 = t;
        double r34029389 = r34029387 * r34029388;
        double r34029390 = a;
        double r34029391 = r34029389 * r34029390;
        double r34029392 = r34029384 - r34029391;
        double r34029393 = b;
        double r34029394 = r34029392 + r34029393;
        double r34029395 = c;
        double r34029396 = r34029385 * r34029395;
        double r34029397 = r34029394 / r34029396;
        return r34029397;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r34029398 = c;
        double r34029399 = -9.889141936680343e+123;
        bool r34029400 = r34029398 <= r34029399;
        double r34029401 = b;
        double r34029402 = z;
        double r34029403 = r34029402 * r34029398;
        double r34029404 = r34029401 / r34029403;
        double r34029405 = 9.0;
        double r34029406 = x;
        double r34029407 = y;
        double r34029408 = r34029407 / r34029398;
        double r34029409 = r34029402 / r34029408;
        double r34029410 = r34029406 / r34029409;
        double r34029411 = r34029405 * r34029410;
        double r34029412 = r34029404 + r34029411;
        double r34029413 = 4.0;
        double r34029414 = a;
        double r34029415 = t;
        double r34029416 = r34029398 / r34029415;
        double r34029417 = r34029414 / r34029416;
        double r34029418 = r34029413 * r34029417;
        double r34029419 = r34029412 - r34029418;
        double r34029420 = 1.3927288177737055e-179;
        bool r34029421 = r34029398 <= r34029420;
        double r34029422 = 1.0;
        double r34029423 = r34029405 * r34029406;
        double r34029424 = r34029407 * r34029423;
        double r34029425 = r34029424 + r34029401;
        double r34029426 = r34029402 / r34029425;
        double r34029427 = r34029422 / r34029426;
        double r34029428 = r34029413 * r34029415;
        double r34029429 = r34029414 * r34029428;
        double r34029430 = r34029427 - r34029429;
        double r34029431 = r34029430 / r34029398;
        double r34029432 = r34029403 / r34029407;
        double r34029433 = r34029406 / r34029432;
        double r34029434 = r34029405 * r34029433;
        double r34029435 = r34029404 + r34029434;
        double r34029436 = r34029414 / r34029398;
        double r34029437 = r34029422 / r34029415;
        double r34029438 = r34029436 / r34029437;
        double r34029439 = r34029413 * r34029438;
        double r34029440 = r34029435 - r34029439;
        double r34029441 = r34029421 ? r34029431 : r34029440;
        double r34029442 = r34029400 ? r34029419 : r34029441;
        return r34029442;
}

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.0
Target14.0
Herbie8.0
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.1708877911747488 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137 \cdot 10^{+130}:\\ \;\;\;\;\left(\left(9.0 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.3838515042456319 \cdot 10^{+158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9.0 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if c < -9.889141936680343e+123

    1. Initial program 24.4

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified19.5

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

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

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    6. Using strategy rm
    7. Applied associate-/l*10.4

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

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

    if -9.889141936680343e+123 < c < 1.3927288177737055e-179

    1. Initial program 15.7

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified5.6

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

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

    if 1.3927288177737055e-179 < c

    1. Initial program 20.8

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified12.9

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

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

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    6. Using strategy rm
    7. Applied associate-/l*8.9

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

      \[\leadsto \left(9.0 \cdot \frac{x}{\frac{z \cdot c}{y}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a}{\color{blue}{c \cdot \frac{1}{t}}}\]
    10. Applied associate-/r*9.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -9.889141936680343 \cdot 10^{+123}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 1.3927288177737055 \cdot 10^{-179}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{y \cdot \left(9.0 \cdot x\right) + b}} - a \cdot \left(4.0 \cdot t\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4.0 \cdot \frac{\frac{a}{c}}{\frac{1}{t}}\\ \end{array}\]

Reproduce

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