Average Error: 20.4 → 11.1
Time: 5.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 9.072552239083735468372762519704485545006 \cdot 10^{-244}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{1}{\frac{c}{a \cdot t}}\\ \mathbf{elif}\;t \le 1.639741556894973767218037706024252248879 \cdot 10^{-48}:\\ \;\;\;\;\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}\\ \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}\;t \le 9.072552239083735468372762519704485545006 \cdot 10^{-244}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{1}{\frac{c}{a \cdot t}}\\

\mathbf{elif}\;t \le 1.639741556894973767218037706024252248879 \cdot 10^{-48}:\\
\;\;\;\;\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}\\

\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 r932585 = x;
        double r932586 = 9.0;
        double r932587 = r932585 * r932586;
        double r932588 = y;
        double r932589 = r932587 * r932588;
        double r932590 = z;
        double r932591 = 4.0;
        double r932592 = r932590 * r932591;
        double r932593 = t;
        double r932594 = r932592 * r932593;
        double r932595 = a;
        double r932596 = r932594 * r932595;
        double r932597 = r932589 - r932596;
        double r932598 = b;
        double r932599 = r932597 + r932598;
        double r932600 = c;
        double r932601 = r932590 * r932600;
        double r932602 = r932599 / r932601;
        return r932602;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r932603 = t;
        double r932604 = 9.072552239083735e-244;
        bool r932605 = r932603 <= r932604;
        double r932606 = b;
        double r932607 = z;
        double r932608 = c;
        double r932609 = r932607 * r932608;
        double r932610 = r932606 / r932609;
        double r932611 = 9.0;
        double r932612 = x;
        double r932613 = r932612 / r932609;
        double r932614 = y;
        double r932615 = r932613 * r932614;
        double r932616 = r932611 * r932615;
        double r932617 = r932610 + r932616;
        double r932618 = 4.0;
        double r932619 = 1.0;
        double r932620 = a;
        double r932621 = r932620 * r932603;
        double r932622 = r932608 / r932621;
        double r932623 = r932619 / r932622;
        double r932624 = r932618 * r932623;
        double r932625 = r932617 - r932624;
        double r932626 = 1.6397415568949738e-48;
        bool r932627 = r932603 <= r932626;
        double r932628 = r932619 / r932607;
        double r932629 = r932612 * r932611;
        double r932630 = r932629 * r932614;
        double r932631 = r932607 * r932618;
        double r932632 = r932631 * r932603;
        double r932633 = r932632 * r932620;
        double r932634 = r932630 - r932633;
        double r932635 = r932634 + r932606;
        double r932636 = r932635 / r932608;
        double r932637 = r932628 * r932636;
        double r932638 = r932608 / r932603;
        double r932639 = r932620 / r932638;
        double r932640 = r932618 * r932639;
        double r932641 = r932617 - r932640;
        double r932642 = r932627 ? r932637 : r932641;
        double r932643 = r932605 ? r932625 : r932642;
        return r932643;
}

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.4
Target15.0
Herbie11.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.100156740804105117061698089246936481893 \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 3 regimes
  2. if t < 9.072552239083735e-244

    1. Initial program 20.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. Taylor expanded around 0 12.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*11.2

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

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

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

    if 9.072552239083735e-244 < t < 1.6397415568949738e-48

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

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

      \[\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.6397415568949738e-48 < t

    1. Initial program 25.4

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le 9.072552239083735468372762519704485545006 \cdot 10^{-244}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{1}{\frac{c}{a \cdot t}}\\ \mathbf{elif}\;t \le 1.639741556894973767218037706024252248879 \cdot 10^{-48}:\\ \;\;\;\;\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}\\ \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 2019353 
(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.1001567408041051e-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.1708877911747488e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* 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)))