Average Error: 7.8 → 1.1
Time: 17.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 \le -1.428478097956767831303888965158296736042 \cdot 10^{226}:\\ \;\;\;\;x \cdot \frac{\frac{y}{2}}{a} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.482623472884415224687383528032564634135 \cdot 10^{189}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a \cdot 2}{y}} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \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 -1.428478097956767831303888965158296736042 \cdot 10^{226}:\\
\;\;\;\;x \cdot \frac{\frac{y}{2}}{a} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a \cdot 2}{y}} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r545174 = x;
        double r545175 = y;
        double r545176 = r545174 * r545175;
        double r545177 = z;
        double r545178 = 9.0;
        double r545179 = r545177 * r545178;
        double r545180 = t;
        double r545181 = r545179 * r545180;
        double r545182 = r545176 - r545181;
        double r545183 = a;
        double r545184 = 2.0;
        double r545185 = r545183 * r545184;
        double r545186 = r545182 / r545185;
        return r545186;
}

double f(double x, double y, double z, double t, double a) {
        double r545187 = x;
        double r545188 = y;
        double r545189 = r545187 * r545188;
        double r545190 = z;
        double r545191 = 9.0;
        double r545192 = r545190 * r545191;
        double r545193 = t;
        double r545194 = r545192 * r545193;
        double r545195 = r545189 - r545194;
        double r545196 = -1.4284780979567678e+226;
        bool r545197 = r545195 <= r545196;
        double r545198 = 2.0;
        double r545199 = r545188 / r545198;
        double r545200 = a;
        double r545201 = r545199 / r545200;
        double r545202 = r545187 * r545201;
        double r545203 = r545192 / r545200;
        double r545204 = r545193 / r545198;
        double r545205 = r545203 * r545204;
        double r545206 = r545202 - r545205;
        double r545207 = 2.482623472884415e+189;
        bool r545208 = r545195 <= r545207;
        double r545209 = r545200 * r545198;
        double r545210 = r545189 / r545209;
        double r545211 = 4.5;
        double r545212 = r545193 * r545190;
        double r545213 = r545212 / r545200;
        double r545214 = r545211 * r545213;
        double r545215 = r545210 - r545214;
        double r545216 = r545209 / r545188;
        double r545217 = r545187 / r545216;
        double r545218 = r545217 - r545205;
        double r545219 = r545208 ? r545215 : r545218;
        double r545220 = r545197 ? r545206 : r545219;
        return r545220;
}

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.8
Target5.8
Herbie1.1
\[\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)) < -1.4284780979567678e+226

    1. Initial program 33.7

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

      \[\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 times-frac17.0

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \color{blue}{\frac{z \cdot 9}{a} \cdot \frac{t}{2}}\]
    6. Using strategy rm
    7. Applied times-frac0.7

      \[\leadsto \color{blue}{\frac{x}{a} \cdot \frac{y}{2}} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\]
    8. Using strategy rm
    9. Applied div-inv0.8

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{a}\right)} \cdot \frac{y}{2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\]
    10. Applied associate-*l*1.0

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

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

    if -1.4284780979567678e+226 < (- (* x y) (* (* z 9.0) t)) < 2.482623472884415e+189

    1. Initial program 1.0

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

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

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

    if 2.482623472884415e+189 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 26.5

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

      \[\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 times-frac15.4

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \color{blue}{\frac{z \cdot 9}{a} \cdot \frac{t}{2}}\]
    6. Using strategy rm
    7. Applied associate-/l*1.7

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

Reproduce

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