Average Error: 20.7 → 8.2
Time: 50.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.044169005035559351954504597189682393615 \cdot 10^{158}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 3.118586638175780375888539724604278606174 \cdot 10^{-63}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + y \cdot \left(9 \cdot x\right)}} - a \cdot \left(4 \cdot t\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \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.044169005035559351954504597189682393615 \cdot 10^{158}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r36151504 = x;
        double r36151505 = 9.0;
        double r36151506 = r36151504 * r36151505;
        double r36151507 = y;
        double r36151508 = r36151506 * r36151507;
        double r36151509 = z;
        double r36151510 = 4.0;
        double r36151511 = r36151509 * r36151510;
        double r36151512 = t;
        double r36151513 = r36151511 * r36151512;
        double r36151514 = a;
        double r36151515 = r36151513 * r36151514;
        double r36151516 = r36151508 - r36151515;
        double r36151517 = b;
        double r36151518 = r36151516 + r36151517;
        double r36151519 = c;
        double r36151520 = r36151509 * r36151519;
        double r36151521 = r36151518 / r36151520;
        return r36151521;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r36151522 = c;
        double r36151523 = -1.0441690050355594e+158;
        bool r36151524 = r36151522 <= r36151523;
        double r36151525 = b;
        double r36151526 = z;
        double r36151527 = r36151526 * r36151522;
        double r36151528 = r36151525 / r36151527;
        double r36151529 = 9.0;
        double r36151530 = x;
        double r36151531 = r36151530 / r36151527;
        double r36151532 = y;
        double r36151533 = r36151531 * r36151532;
        double r36151534 = r36151529 * r36151533;
        double r36151535 = r36151528 + r36151534;
        double r36151536 = 4.0;
        double r36151537 = a;
        double r36151538 = t;
        double r36151539 = r36151522 / r36151538;
        double r36151540 = r36151537 / r36151539;
        double r36151541 = r36151536 * r36151540;
        double r36151542 = r36151535 - r36151541;
        double r36151543 = 3.1185866381757804e-63;
        bool r36151544 = r36151522 <= r36151543;
        double r36151545 = 1.0;
        double r36151546 = r36151529 * r36151530;
        double r36151547 = r36151532 * r36151546;
        double r36151548 = r36151525 + r36151547;
        double r36151549 = r36151526 / r36151548;
        double r36151550 = r36151545 / r36151549;
        double r36151551 = r36151536 * r36151538;
        double r36151552 = r36151537 * r36151551;
        double r36151553 = r36151550 - r36151552;
        double r36151554 = r36151553 / r36151522;
        double r36151555 = r36151544 ? r36151554 : r36151542;
        double r36151556 = r36151524 ? r36151542 : r36151555;
        return r36151556;
}

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.7
Target14.5
Herbie8.2
\[\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 c < -1.0441690050355594e+158 or 3.1185866381757804e-63 < c

    1. Initial program 23.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. Simplified17.3

      \[\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 14.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 associate-/l*11.5

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

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

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

    if -1.0441690050355594e+158 < c < 3.1185866381757804e-63

    1. Initial program 16.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. Simplified6.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -1.044169005035559351954504597189682393615 \cdot 10^{158}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 3.118586638175780375888539724604278606174 \cdot 10^{-63}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{b + y \cdot \left(9 \cdot x\right)}} - a \cdot \left(4 \cdot t\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{a}{\frac{c}{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)))