Average Error: 8.0 → 6.9
Time: 20.5s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.685148343540057387824032191481377617735 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - \frac{t \cdot 9}{a} \cdot \frac{z}{2}\\ \mathbf{elif}\;y \le -4.849375291070953745271537790527835100917 \cdot 10^{-188}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2} \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\frac{z}{\frac{\frac{a}{t}}{9}}}{2}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;y \le -4.685148343540057387824032191481377617735 \cdot 10^{-61}:\\
\;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - \frac{t \cdot 9}{a} \cdot \frac{z}{2}\\

\mathbf{elif}\;y \le -4.849375291070953745271537790527835100917 \cdot 10^{-188}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2} \cdot \frac{1}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\frac{z}{\frac{\frac{a}{t}}{9}}}{2}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r610675 = x;
        double r610676 = y;
        double r610677 = r610675 * r610676;
        double r610678 = z;
        double r610679 = 9.0;
        double r610680 = r610678 * r610679;
        double r610681 = t;
        double r610682 = r610680 * r610681;
        double r610683 = r610677 - r610682;
        double r610684 = a;
        double r610685 = 2.0;
        double r610686 = r610684 * r610685;
        double r610687 = r610683 / r610686;
        return r610687;
}

double f(double x, double y, double z, double t, double a) {
        double r610688 = y;
        double r610689 = -4.6851483435400574e-61;
        bool r610690 = r610688 <= r610689;
        double r610691 = a;
        double r610692 = r610688 / r610691;
        double r610693 = x;
        double r610694 = 2.0;
        double r610695 = r610693 / r610694;
        double r610696 = r610692 * r610695;
        double r610697 = t;
        double r610698 = 9.0;
        double r610699 = r610697 * r610698;
        double r610700 = r610699 / r610691;
        double r610701 = z;
        double r610702 = r610701 / r610694;
        double r610703 = r610700 * r610702;
        double r610704 = r610696 - r610703;
        double r610705 = -4.849375291070954e-188;
        bool r610706 = r610688 <= r610705;
        double r610707 = r610693 * r610688;
        double r610708 = r610701 * r610699;
        double r610709 = r610707 - r610708;
        double r610710 = r610709 / r610694;
        double r610711 = 1.0;
        double r610712 = r610711 / r610691;
        double r610713 = r610710 * r610712;
        double r610714 = r610691 * r610694;
        double r610715 = r610707 / r610714;
        double r610716 = r610691 / r610697;
        double r610717 = r610716 / r610698;
        double r610718 = r610701 / r610717;
        double r610719 = r610718 / r610694;
        double r610720 = r610715 - r610719;
        double r610721 = r610706 ? r610713 : r610720;
        double r610722 = r610690 ? r610704 : r610721;
        return r610722;
}

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

Original8.0
Target6.0
Herbie6.9
\[\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 3 regimes
  2. if y < -4.6851483435400574e-61

    1. Initial program 10.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-sub10.9

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}}\]
    4. Simplified10.9

      \[\leadsto \color{blue}{\frac{x \cdot y}{2 \cdot a}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. Simplified10.3

      \[\leadsto \frac{x \cdot y}{2 \cdot a} - \color{blue}{\frac{z}{2} \cdot \frac{t \cdot 9}{a}}\]
    6. Using strategy rm
    7. Applied times-frac7.3

      \[\leadsto \color{blue}{\frac{x}{2} \cdot \frac{y}{a}} - \frac{z}{2} \cdot \frac{t \cdot 9}{a}\]

    if -4.6851483435400574e-61 < y < -4.849375291070954e-188

    1. Initial program 4.7

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity4.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)}}{a \cdot 2}\]
    4. Applied times-frac4.8

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{2}}\]
    5. Simplified4.9

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

    if -4.849375291070954e-188 < y

    1. Initial program 7.4

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-sub7.4

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{2 \cdot a}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    5. Simplified7.2

      \[\leadsto \frac{x \cdot y}{2 \cdot a} - \color{blue}{\frac{z}{2} \cdot \frac{t \cdot 9}{a}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity7.2

      \[\leadsto \frac{x \cdot y}{2 \cdot a} - \color{blue}{\left(1 \cdot \frac{z}{2}\right)} \cdot \frac{t \cdot 9}{a}\]
    8. Applied associate-*l*7.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.685148343540057387824032191481377617735 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{a} \cdot \frac{x}{2} - \frac{t \cdot 9}{a} \cdot \frac{z}{2}\\ \mathbf{elif}\;y \le -4.849375291070953745271537790527835100917 \cdot 10^{-188}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{2} \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\frac{z}{\frac{\frac{a}{t}}{9}}}{2}\\ \end{array}\]

Reproduce

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

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))