Average Error: 20.6 → 6.7
Time: 20.9s
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 -5.954233000426847086997522288987507815784 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \le 2.913349643882600583493622491883397705725 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \left(b + y \cdot \left(9 \cdot x\right)\right) - a \cdot \left(4 \cdot t\right)}{c}\\ \mathbf{elif}\;c \le 5.333816498957335745487056198734101788258 \cdot 10^{218}:\\ \;\;\;\;\left(\frac{1}{z} \cdot \frac{b}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right) + \frac{b}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{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 -5.954233000426847086997522288987507815784 \cdot 10^{-13}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r37559558 = x;
        double r37559559 = 9.0;
        double r37559560 = r37559558 * r37559559;
        double r37559561 = y;
        double r37559562 = r37559560 * r37559561;
        double r37559563 = z;
        double r37559564 = 4.0;
        double r37559565 = r37559563 * r37559564;
        double r37559566 = t;
        double r37559567 = r37559565 * r37559566;
        double r37559568 = a;
        double r37559569 = r37559567 * r37559568;
        double r37559570 = r37559562 - r37559569;
        double r37559571 = b;
        double r37559572 = r37559570 + r37559571;
        double r37559573 = c;
        double r37559574 = r37559563 * r37559573;
        double r37559575 = r37559572 / r37559574;
        return r37559575;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r37559576 = c;
        double r37559577 = -5.954233000426847e-13;
        bool r37559578 = r37559576 <= r37559577;
        double r37559579 = b;
        double r37559580 = z;
        double r37559581 = r37559580 * r37559576;
        double r37559582 = r37559579 / r37559581;
        double r37559583 = 9.0;
        double r37559584 = x;
        double r37559585 = y;
        double r37559586 = r37559576 / r37559585;
        double r37559587 = r37559586 * r37559580;
        double r37559588 = r37559584 / r37559587;
        double r37559589 = r37559583 * r37559588;
        double r37559590 = r37559582 + r37559589;
        double r37559591 = 4.0;
        double r37559592 = a;
        double r37559593 = t;
        double r37559594 = r37559593 / r37559576;
        double r37559595 = r37559592 * r37559594;
        double r37559596 = r37559591 * r37559595;
        double r37559597 = r37559590 - r37559596;
        double r37559598 = 2.9133496438826006e-11;
        bool r37559599 = r37559576 <= r37559598;
        double r37559600 = 1.0;
        double r37559601 = r37559600 / r37559580;
        double r37559602 = r37559583 * r37559584;
        double r37559603 = r37559585 * r37559602;
        double r37559604 = r37559579 + r37559603;
        double r37559605 = r37559601 * r37559604;
        double r37559606 = r37559591 * r37559593;
        double r37559607 = r37559592 * r37559606;
        double r37559608 = r37559605 - r37559607;
        double r37559609 = r37559608 / r37559576;
        double r37559610 = 5.333816498957336e+218;
        bool r37559611 = r37559576 <= r37559610;
        double r37559612 = r37559579 / r37559576;
        double r37559613 = r37559601 * r37559612;
        double r37559614 = r37559581 / r37559585;
        double r37559615 = r37559584 / r37559614;
        double r37559616 = r37559583 * r37559615;
        double r37559617 = r37559613 + r37559616;
        double r37559618 = r37559617 - r37559596;
        double r37559619 = r37559585 / r37559576;
        double r37559620 = r37559584 / r37559580;
        double r37559621 = r37559620 * r37559583;
        double r37559622 = r37559619 * r37559621;
        double r37559623 = r37559622 + r37559582;
        double r37559624 = r37559623 - r37559596;
        double r37559625 = r37559611 ? r37559618 : r37559624;
        double r37559626 = r37559599 ? r37559609 : r37559625;
        double r37559627 = r37559578 ? r37559597 : r37559626;
        return r37559627;
}

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.8
Herbie6.7
\[\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 c < -5.954233000426847e-13

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

      \[\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-identity14.8

      \[\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 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 \left(a \cdot \frac{t}{c}\right)\]
    10. Using strategy rm
    11. Applied *-un-lft-identity9.3

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

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

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

    if -5.954233000426847e-13 < c < 2.9133496438826006e-11

    1. Initial program 14.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. Simplified2.9

      \[\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 div-inv3.0

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

    if 2.9133496438826006e-11 < c < 5.333816498957336e+218

    1. Initial program 21.1

      \[\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. Simplified15.7

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

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

      \[\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-frac8.7

      \[\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. Simplified8.7

      \[\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 associate-/l*6.0

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

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

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

    if 5.333816498957336e+218 < c

    1. Initial program 27.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. Simplified23.8

      \[\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 20.3

      \[\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-identity20.3

      \[\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-frac15.0

      \[\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. Simplified15.0

      \[\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 times-frac16.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -5.954233000426847086997522288987507815784 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{elif}\;c \le 2.913349643882600583493622491883397705725 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \left(b + y \cdot \left(9 \cdot x\right)\right) - a \cdot \left(4 \cdot t\right)}{c}\\ \mathbf{elif}\;c \le 5.333816498957335745487056198734101788258 \cdot 10^{218}:\\ \;\;\;\;\left(\frac{1}{z} \cdot \frac{b}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right) + \frac{b}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \end{array}\]

Reproduce

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