Average Error: 7.4 → 0.7
Time: 4.3s
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 \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 6.141503698191325974880769654002209246573 \cdot 10^{255}:\\ \;\;\;\;0.5 \cdot \left(\frac{1}{a} \cdot \left(x \cdot y\right)\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{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 = -\infty:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r757194 = x;
        double r757195 = y;
        double r757196 = r757194 * r757195;
        double r757197 = z;
        double r757198 = 9.0;
        double r757199 = r757197 * r757198;
        double r757200 = t;
        double r757201 = r757199 * r757200;
        double r757202 = r757196 - r757201;
        double r757203 = a;
        double r757204 = 2.0;
        double r757205 = r757203 * r757204;
        double r757206 = r757202 / r757205;
        return r757206;
}

double f(double x, double y, double z, double t, double a) {
        double r757207 = x;
        double r757208 = y;
        double r757209 = r757207 * r757208;
        double r757210 = z;
        double r757211 = 9.0;
        double r757212 = r757210 * r757211;
        double r757213 = t;
        double r757214 = r757212 * r757213;
        double r757215 = r757209 - r757214;
        double r757216 = -inf.0;
        bool r757217 = r757215 <= r757216;
        double r757218 = 0.5;
        double r757219 = a;
        double r757220 = r757219 / r757208;
        double r757221 = r757207 / r757220;
        double r757222 = r757218 * r757221;
        double r757223 = 4.5;
        double r757224 = r757219 / r757210;
        double r757225 = r757213 / r757224;
        double r757226 = r757223 * r757225;
        double r757227 = r757222 - r757226;
        double r757228 = 6.141503698191326e+255;
        bool r757229 = r757215 <= r757228;
        double r757230 = 1.0;
        double r757231 = r757230 / r757219;
        double r757232 = r757231 * r757209;
        double r757233 = r757218 * r757232;
        double r757234 = r757213 * r757210;
        double r757235 = r757234 / r757219;
        double r757236 = r757223 * r757235;
        double r757237 = r757233 - r757236;
        double r757238 = r757213 * r757223;
        double r757239 = r757210 / r757219;
        double r757240 = r757238 * r757239;
        double r757241 = r757222 - r757240;
        double r757242 = r757229 ? r757237 : r757241;
        double r757243 = r757217 ? r757227 : r757242;
        return r757243;
}

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.4
Target5.6
Herbie0.7
\[\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) (* (* 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.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*32.6

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

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

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

    1. Initial program 0.7

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied div-inv4.9

      \[\leadsto 0.5 \cdot \frac{x}{\color{blue}{a \cdot \frac{1}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Applied *-un-lft-identity4.9

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

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

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

    if 6.141503698191326e+255 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 43.3

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

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

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

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

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

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

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

Reproduce

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