Average Error: 7.7 → 4.6
Time: 16.4s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 1.755217261824067524730001413389972848672 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot 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 = -\infty:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r482912 = x;
        double r482913 = y;
        double r482914 = r482912 * r482913;
        double r482915 = z;
        double r482916 = 9.0;
        double r482917 = r482915 * r482916;
        double r482918 = t;
        double r482919 = r482917 * r482918;
        double r482920 = r482914 - r482919;
        double r482921 = a;
        double r482922 = 2.0;
        double r482923 = r482921 * r482922;
        double r482924 = r482920 / r482923;
        return r482924;
}

double f(double x, double y, double z, double t, double a) {
        double r482925 = x;
        double r482926 = y;
        double r482927 = r482925 * r482926;
        double r482928 = -inf.0;
        bool r482929 = r482927 <= r482928;
        double r482930 = 0.5;
        double r482931 = a;
        double r482932 = r482931 / r482926;
        double r482933 = r482925 / r482932;
        double r482934 = r482930 * r482933;
        double r482935 = 4.5;
        double r482936 = t;
        double r482937 = z;
        double r482938 = r482936 * r482937;
        double r482939 = r482938 / r482931;
        double r482940 = r482935 * r482939;
        double r482941 = r482934 - r482940;
        double r482942 = 1.7552172618240675e+270;
        bool r482943 = r482927 <= r482942;
        double r482944 = 2.0;
        double r482945 = r482931 * r482944;
        double r482946 = r482927 / r482945;
        double r482947 = 9.0;
        double r482948 = r482937 * r482947;
        double r482949 = r482948 * r482936;
        double r482950 = r482949 / r482945;
        double r482951 = r482946 - r482950;
        double r482952 = r482926 / r482931;
        double r482953 = r482925 * r482952;
        double r482954 = r482930 * r482953;
        double r482955 = r482954 - r482940;
        double r482956 = r482943 ? r482951 : r482955;
        double r482957 = r482929 ? r482941 : r482956;
        return r482957;
}

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.5
Herbie4.6
\[\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 (* x y) < -inf.0

    1. Initial program 64.0

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

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

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

    if -inf.0 < (* x y) < 1.7552172618240675e+270

    1. Initial program 4.3

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}}\]
    4. Using strategy rm
    5. Applied pow14.3

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

    if 1.7552172618240675e+270 < (* x y)

    1. Initial program 47.3

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 47.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 *-un-lft-identity47.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 1.755217261824067524730001413389972848672 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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