Average Error: 7.7 → 1.1
Time: 16.1s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -2.157070698117764542052953483850113531869 \cdot 10^{268} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.967056092002857937365330199455399222176 \cdot 10^{173}\right):\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -2.157070698117764542052953483850113531869 \cdot 10^{268} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.967056092002857937365330199455399222176 \cdot 10^{173}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r44409 = x;
        double r44410 = y;
        double r44411 = r44409 * r44410;
        double r44412 = z;
        double r44413 = 9.0;
        double r44414 = r44412 * r44413;
        double r44415 = t;
        double r44416 = r44414 * r44415;
        double r44417 = r44411 - r44416;
        double r44418 = a;
        double r44419 = 2.0;
        double r44420 = r44418 * r44419;
        double r44421 = r44417 / r44420;
        return r44421;
}

double f(double x, double y, double z, double t, double a) {
        double r44422 = x;
        double r44423 = y;
        double r44424 = r44422 * r44423;
        double r44425 = z;
        double r44426 = 9.0;
        double r44427 = r44425 * r44426;
        double r44428 = t;
        double r44429 = r44427 * r44428;
        double r44430 = r44424 - r44429;
        double r44431 = -2.1570706981177645e+268;
        bool r44432 = r44430 <= r44431;
        double r44433 = 2.967056092002858e+173;
        bool r44434 = r44430 <= r44433;
        double r44435 = !r44434;
        bool r44436 = r44432 || r44435;
        double r44437 = 0.5;
        double r44438 = a;
        double r44439 = r44423 / r44438;
        double r44440 = r44422 * r44439;
        double r44441 = r44437 * r44440;
        double r44442 = 4.5;
        double r44443 = r44425 / r44438;
        double r44444 = r44428 * r44443;
        double r44445 = r44442 * r44444;
        double r44446 = r44441 - r44445;
        double r44447 = r44424 / r44438;
        double r44448 = r44437 * r44447;
        double r44449 = cbrt(r44442);
        double r44450 = r44449 * r44449;
        double r44451 = r44428 * r44425;
        double r44452 = r44451 / r44438;
        double r44453 = r44449 * r44452;
        double r44454 = r44450 * r44453;
        double r44455 = r44448 - r44454;
        double r44456 = r44436 ? r44446 : r44455;
        return r44456;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.7
Target5.3
Herbie1.1
\[\begin{array}{l} \mathbf{if}\;a \lt -2.090464557976709043451944897028999329376 \cdot 10^{86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \lt 2.144030707833976090627817222818061808815 \cdot 10^{99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -2.1570706981177645e+268 or 2.967056092002858e+173 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 30.8

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 30.4

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity30.4

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac16.7

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{1} \cdot \frac{y}{a}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
    6. Simplified16.7

      \[\leadsto 0.5 \cdot \left(\color{blue}{x} \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity16.7

      \[\leadsto 0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    9. Applied times-frac1.6

      \[\leadsto 0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \color{blue}{\left(\frac{t}{1} \cdot \frac{z}{a}\right)}\]
    10. Simplified1.6

      \[\leadsto 0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(\color{blue}{t} \cdot \frac{z}{a}\right)\]

    if -2.1570706981177645e+268 < (- (* x y) (* (* z 9.0) t)) < 2.967056092002858e+173

    1. Initial program 0.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 0.9

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.9

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\left(\left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \sqrt[3]{4.5}\right)} \cdot \frac{t \cdot z}{a}\]
    5. Applied associate-*l*0.9

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -2.157070698117764542052953483850113531869 \cdot 10^{268} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.967056092002857937365330199455399222176 \cdot 10^{173}\right):\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019310 +o rules:numerics
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"
  :precision binary64

  :herbie-target
  (if (< a -2.090464557976709e86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.14403070783397609e99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9) t)) (* a 2)))