Average Error: 8.0 → 4.6
Time: 3.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 - \left(z \cdot 9\right) \cdot t \le -4.03283629370113762 \cdot 10^{287}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 6.15442072676607707 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot y - 9 \cdot \left(t \cdot z\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 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 - \left(z \cdot 9\right) \cdot t \le -4.03283629370113762 \cdot 10^{287}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r710852 = x;
        double r710853 = y;
        double r710854 = r710852 * r710853;
        double r710855 = z;
        double r710856 = 9.0;
        double r710857 = r710855 * r710856;
        double r710858 = t;
        double r710859 = r710857 * r710858;
        double r710860 = r710854 - r710859;
        double r710861 = a;
        double r710862 = 2.0;
        double r710863 = r710861 * r710862;
        double r710864 = r710860 / r710863;
        return r710864;
}

double f(double x, double y, double z, double t, double a) {
        double r710865 = x;
        double r710866 = y;
        double r710867 = r710865 * r710866;
        double r710868 = z;
        double r710869 = 9.0;
        double r710870 = r710868 * r710869;
        double r710871 = t;
        double r710872 = r710870 * r710871;
        double r710873 = r710867 - r710872;
        double r710874 = -4.0328362937011376e+287;
        bool r710875 = r710873 <= r710874;
        double r710876 = 0.5;
        double r710877 = a;
        double r710878 = r710867 / r710877;
        double r710879 = r710876 * r710878;
        double r710880 = 4.5;
        double r710881 = r710871 * r710880;
        double r710882 = r710868 / r710877;
        double r710883 = r710881 * r710882;
        double r710884 = r710879 - r710883;
        double r710885 = 6.154420726766077e+270;
        bool r710886 = r710873 <= r710885;
        double r710887 = r710871 * r710868;
        double r710888 = r710869 * r710887;
        double r710889 = r710867 - r710888;
        double r710890 = 2.0;
        double r710891 = r710877 * r710890;
        double r710892 = r710889 / r710891;
        double r710893 = r710877 / r710866;
        double r710894 = r710865 / r710893;
        double r710895 = r710876 * r710894;
        double r710896 = r710887 / r710877;
        double r710897 = r710880 * r710896;
        double r710898 = r710895 - r710897;
        double r710899 = r710886 ? r710892 : r710898;
        double r710900 = r710875 ? r710884 : r710899;
        return r710900;
}

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
Target5.8
Herbie4.6
\[\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)) < -4.0328362937011376e+287

    1. Initial program 54.9

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

      \[\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-identity54.2

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

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

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

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

    if -4.0328362937011376e+287 < (- (* x y) (* (* z 9.0) t)) < 6.154420726766077e+270

    1. Initial program 0.8

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

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

    if 6.154420726766077e+270 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 48.6

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 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 - \left(z \cdot 9\right) \cdot t \le -4.03283629370113762 \cdot 10^{287}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 6.15442072676607707 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot y - 9 \cdot \left(t \cdot z\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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