Average Error: 7.7 → 1.1
Time: 3.6s
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 = -\infty:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.1711728114772955 \cdot 10^{153}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \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 = -\infty:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r726090 = x;
        double r726091 = y;
        double r726092 = r726090 * r726091;
        double r726093 = z;
        double r726094 = 9.0;
        double r726095 = r726093 * r726094;
        double r726096 = t;
        double r726097 = r726095 * r726096;
        double r726098 = r726092 - r726097;
        double r726099 = a;
        double r726100 = 2.0;
        double r726101 = r726099 * r726100;
        double r726102 = r726098 / r726101;
        return r726102;
}

double f(double x, double y, double z, double t, double a) {
        double r726103 = x;
        double r726104 = y;
        double r726105 = r726103 * r726104;
        double r726106 = z;
        double r726107 = 9.0;
        double r726108 = r726106 * r726107;
        double r726109 = t;
        double r726110 = r726108 * r726109;
        double r726111 = r726105 - r726110;
        double r726112 = -inf.0;
        bool r726113 = r726111 <= r726112;
        double r726114 = 0.5;
        double r726115 = a;
        double r726116 = r726104 / r726115;
        double r726117 = r726103 * r726116;
        double r726118 = r726114 * r726117;
        double r726119 = 4.5;
        double r726120 = r726115 / r726106;
        double r726121 = r726109 / r726120;
        double r726122 = r726119 * r726121;
        double r726123 = r726118 - r726122;
        double r726124 = 3.1711728114772955e+153;
        bool r726125 = r726111 <= r726124;
        double r726126 = r726105 / r726115;
        double r726127 = r726114 * r726126;
        double r726128 = r726109 * r726106;
        double r726129 = r726128 / r726115;
        double r726130 = r726119 * r726129;
        double r726131 = r726127 - r726130;
        double r726132 = r726115 / r726104;
        double r726133 = r726103 / r726132;
        double r726134 = r726114 * r726133;
        double r726135 = r726134 - r726122;
        double r726136 = r726125 ? r726131 : r726135;
        double r726137 = r726113 ? r726123 : r726136;
        return r726137;
}

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
Herbie1.1
\[\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)) < -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 63.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 associate-/l*34.4

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity34.4

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

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

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

    if -inf.0 < (- (* x y) (* (* z 9.0) t)) < 3.1711728114772955e+153

    1. Initial program 0.9

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

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Taylor expanded around 0 0.9

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

    if 3.1711728114772955e+153 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 21.1

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

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Using strategy rm
    6. Applied associate-/l*2.5

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

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

Reproduce

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