Average Error: 7.5 → 4.4
Time: 17.4s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le -1.7009871229814204 \cdot 10^{-138}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;x \cdot y \le 3.02867825195745 \cdot 10^{-161}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le 6.886896017153369 \cdot 10^{+170}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r35658910 = x;
        double r35658911 = y;
        double r35658912 = r35658910 * r35658911;
        double r35658913 = z;
        double r35658914 = 9.0;
        double r35658915 = r35658913 * r35658914;
        double r35658916 = t;
        double r35658917 = r35658915 * r35658916;
        double r35658918 = r35658912 - r35658917;
        double r35658919 = a;
        double r35658920 = 2.0;
        double r35658921 = r35658919 * r35658920;
        double r35658922 = r35658918 / r35658921;
        return r35658922;
}

double f(double x, double y, double z, double t, double a) {
        double r35658923 = x;
        double r35658924 = y;
        double r35658925 = r35658923 * r35658924;
        double r35658926 = -inf.0;
        bool r35658927 = r35658925 <= r35658926;
        double r35658928 = a;
        double r35658929 = r35658928 / r35658924;
        double r35658930 = r35658923 / r35658929;
        double r35658931 = 0.5;
        double r35658932 = r35658930 * r35658931;
        double r35658933 = t;
        double r35658934 = z;
        double r35658935 = r35658933 * r35658934;
        double r35658936 = r35658935 / r35658928;
        double r35658937 = 4.5;
        double r35658938 = r35658936 * r35658937;
        double r35658939 = r35658932 - r35658938;
        double r35658940 = -1.7009871229814204e-138;
        bool r35658941 = r35658925 <= r35658940;
        double r35658942 = r35658925 / r35658928;
        double r35658943 = r35658931 * r35658942;
        double r35658944 = r35658934 / r35658928;
        double r35658945 = r35658944 * r35658933;
        double r35658946 = r35658937 * r35658945;
        double r35658947 = r35658943 - r35658946;
        double r35658948 = 3.02867825195745e-161;
        bool r35658949 = r35658925 <= r35658948;
        double r35658950 = r35658924 / r35658928;
        double r35658951 = r35658950 * r35658923;
        double r35658952 = r35658931 * r35658951;
        double r35658953 = r35658952 - r35658938;
        double r35658954 = 6.886896017153369e+170;
        bool r35658955 = r35658925 <= r35658954;
        double r35658956 = r35658955 ? r35658947 : r35658953;
        double r35658957 = r35658949 ? r35658953 : r35658956;
        double r35658958 = r35658941 ? r35658947 : r35658957;
        double r35658959 = r35658927 ? r35658939 : r35658958;
        return r35658959;
}

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.5
Target5.5
Herbie4.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.144030707833976 \cdot 10^{+99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9.0 \cdot t\right)}{a \cdot 2.0}\\ \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 60.1

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

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

      \[\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.7009871229814204e-138 or 3.02867825195745e-161 < (* x y) < 6.886896017153369e+170

    1. Initial program 3.6

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

      \[\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-identity3.6

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

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

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

    if -1.7009871229814204e-138 < (* x y) < 3.02867825195745e-161 or 6.886896017153369e+170 < (* x y)

    1. Initial program 8.7

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

      \[\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-identity8.7

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac5.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. Simplified5.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.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le -1.7009871229814204 \cdot 10^{-138}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;x \cdot y \le 3.02867825195745 \cdot 10^{-161}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \mathbf{elif}\;x \cdot y \le 6.886896017153369 \cdot 10^{+170}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{a} \cdot x\right) - \frac{t \cdot z}{a} \cdot 4.5\\ \end{array}\]

Reproduce

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