Average Error: 7.7 → 4.4
Time: 18.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 \le -1.458727220089207535864960016002575750906 \cdot 10^{52} \lor \neg \left(x \cdot y \le 3.207670897783330876086711438188194021875 \cdot 10^{226}\right):\\ \;\;\;\;\frac{y}{\frac{a}{x}} \cdot 0.5 - \frac{4.5 \cdot t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y - \left(t \cdot z\right) \cdot 9}{a}}{2}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.458727220089207535864960016002575750906 \cdot 10^{52} \lor \neg \left(x \cdot y \le 3.207670897783330876086711438188194021875 \cdot 10^{226}\right):\\
\;\;\;\;\frac{y}{\frac{a}{x}} \cdot 0.5 - \frac{4.5 \cdot t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r577833 = x;
        double r577834 = y;
        double r577835 = r577833 * r577834;
        double r577836 = z;
        double r577837 = 9.0;
        double r577838 = r577836 * r577837;
        double r577839 = t;
        double r577840 = r577838 * r577839;
        double r577841 = r577835 - r577840;
        double r577842 = a;
        double r577843 = 2.0;
        double r577844 = r577842 * r577843;
        double r577845 = r577841 / r577844;
        return r577845;
}

double f(double x, double y, double z, double t, double a) {
        double r577846 = x;
        double r577847 = y;
        double r577848 = r577846 * r577847;
        double r577849 = -1.4587272200892075e+52;
        bool r577850 = r577848 <= r577849;
        double r577851 = 3.207670897783331e+226;
        bool r577852 = r577848 <= r577851;
        double r577853 = !r577852;
        bool r577854 = r577850 || r577853;
        double r577855 = a;
        double r577856 = r577855 / r577846;
        double r577857 = r577847 / r577856;
        double r577858 = 0.5;
        double r577859 = r577857 * r577858;
        double r577860 = 4.5;
        double r577861 = t;
        double r577862 = r577860 * r577861;
        double r577863 = z;
        double r577864 = r577855 / r577863;
        double r577865 = r577862 / r577864;
        double r577866 = r577859 - r577865;
        double r577867 = r577861 * r577863;
        double r577868 = 9.0;
        double r577869 = r577867 * r577868;
        double r577870 = r577848 - r577869;
        double r577871 = r577870 / r577855;
        double r577872 = 2.0;
        double r577873 = r577871 / r577872;
        double r577874 = r577854 ? r577866 : r577873;
        return r577874;
}

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.4
Herbie4.4
\[\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) < -1.4587272200892075e+52 or 3.207670897783331e+226 < (* x y)

    1. Initial program 20.1

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    6. Simplified4.3

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

    if -1.4587272200892075e+52 < (* x y) < 3.207670897783331e+226

    1. Initial program 4.5

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - \left(t \cdot 9\right) \cdot z} \cdot 2}}\]
    5. Using strategy rm
    6. Applied div-inv5.0

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

      \[\leadsto \frac{1}{\left(a \cdot \color{blue}{\frac{1}{x \cdot y - \left(9 \cdot z\right) \cdot t}}\right) \cdot 2}\]
    8. Using strategy rm
    9. Applied div-inv4.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.458727220089207535864960016002575750906 \cdot 10^{52} \lor \neg \left(x \cdot y \le 3.207670897783330876086711438188194021875 \cdot 10^{226}\right):\\ \;\;\;\;\frac{y}{\frac{a}{x}} \cdot 0.5 - \frac{4.5 \cdot t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y - \left(t \cdot z\right) \cdot 9}{a}}{2}\\ \end{array}\]

Reproduce

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