Average Error: 7.6 → 0.4
Time: 4.2s
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 -1.36857222160745089 \cdot 10^{274}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.01111215189906504 \cdot 10^{-182}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.5724639025951766 \cdot 10^{-309}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \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 -1.36857222160745089 \cdot 10^{274}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.01111215189906504 \cdot 10^{-182}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.5724639025951766 \cdot 10^{-309}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r855394 = x;
        double r855395 = y;
        double r855396 = r855394 * r855395;
        double r855397 = z;
        double r855398 = 9.0;
        double r855399 = r855397 * r855398;
        double r855400 = t;
        double r855401 = r855399 * r855400;
        double r855402 = r855396 - r855401;
        double r855403 = a;
        double r855404 = 2.0;
        double r855405 = r855403 * r855404;
        double r855406 = r855402 / r855405;
        return r855406;
}

double f(double x, double y, double z, double t, double a) {
        double r855407 = x;
        double r855408 = y;
        double r855409 = r855407 * r855408;
        double r855410 = z;
        double r855411 = 9.0;
        double r855412 = r855410 * r855411;
        double r855413 = t;
        double r855414 = r855412 * r855413;
        double r855415 = r855409 - r855414;
        double r855416 = -1.3685722216074509e+274;
        bool r855417 = r855415 <= r855416;
        double r855418 = 0.5;
        double r855419 = a;
        double r855420 = r855419 / r855408;
        double r855421 = r855407 / r855420;
        double r855422 = r855418 * r855421;
        double r855423 = 4.5;
        double r855424 = r855413 * r855423;
        double r855425 = r855410 / r855419;
        double r855426 = r855424 * r855425;
        double r855427 = r855422 - r855426;
        double r855428 = -8.011112151899065e-182;
        bool r855429 = r855415 <= r855428;
        double r855430 = r855409 / r855419;
        double r855431 = r855418 * r855430;
        double r855432 = r855413 * r855410;
        double r855433 = r855423 * r855432;
        double r855434 = r855433 / r855419;
        double r855435 = r855431 - r855434;
        double r855436 = 4.572463902595177e-309;
        bool r855437 = r855415 <= r855436;
        double r855438 = 2.9481906601273705e+262;
        bool r855439 = r855415 <= r855438;
        double r855440 = r855418 / r855419;
        double r855441 = 1.0;
        double r855442 = r855441 / r855408;
        double r855443 = r855407 / r855442;
        double r855444 = r855440 * r855443;
        double r855445 = r855432 / r855419;
        double r855446 = r855423 * r855445;
        double r855447 = r855444 - r855446;
        double r855448 = r855439 ? r855447 : r855427;
        double r855449 = r855437 ? r855427 : r855448;
        double r855450 = r855429 ? r855435 : r855449;
        double r855451 = r855417 ? r855427 : r855450;
        return r855451;
}

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.6
Target5.8
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;a \lt -2.090464557976709 \cdot 10^{86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \lt 2.14403070783397609 \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 3 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -1.3685722216074509e+274 or -8.011112151899065e-182 < (- (* x y) (* (* z 9.0) t)) < 4.572463902595177e-309 or 2.9481906601273705e+262 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 36.2

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity18.8

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

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \color{blue}{\left(\frac{t}{1} \cdot \frac{z}{a}\right)}\]
    8. Applied associate-*r*0.8

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

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

    if -1.3685722216074509e+274 < (- (* x y) (* (* z 9.0) t)) < -8.011112151899065e-182

    1. Initial program 0.3

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

      \[\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 associate-*r/0.3

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

    if 4.572463902595177e-309 < (- (* x y) (* (* z 9.0) t)) < 2.9481906601273705e+262

    1. Initial program 0.3

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

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied div-inv4.8

      \[\leadsto 0.5 \cdot \frac{x}{\color{blue}{a \cdot \frac{1}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Applied *-un-lft-identity4.8

      \[\leadsto 0.5 \cdot \frac{\color{blue}{1 \cdot x}}{a \cdot \frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Applied times-frac0.4

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{1}{a} \cdot \frac{x}{\frac{1}{y}}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
    9. Applied associate-*r*0.4

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

      \[\leadsto \color{blue}{\frac{0.5}{a}} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -1.36857222160745089 \cdot 10^{274}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.01111215189906504 \cdot 10^{-182}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.5724639025951766 \cdot 10^{-309}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

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