Average Error: 7.8 → 4.5
Time: 3.7s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -2.7904904621703741 \cdot 10^{199}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{1} \cdot \left(\frac{9}{a} \cdot \frac{t}{2}\right)\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le -3.636338125685552 \cdot 10^{-268}:\\ \;\;\;\;\frac{x}{\frac{a \cdot 2}{y}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.6072122227500546 \cdot 10^{-297}:\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.185335056027168 \cdot 10^{105}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \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}\;\left(z \cdot 9\right) \cdot t \le -2.7904904621703741 \cdot 10^{199}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{1} \cdot \left(\frac{9}{a} \cdot \frac{t}{2}\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r675251 = x;
        double r675252 = y;
        double r675253 = r675251 * r675252;
        double r675254 = z;
        double r675255 = 9.0;
        double r675256 = r675254 * r675255;
        double r675257 = t;
        double r675258 = r675256 * r675257;
        double r675259 = r675253 - r675258;
        double r675260 = a;
        double r675261 = 2.0;
        double r675262 = r675260 * r675261;
        double r675263 = r675259 / r675262;
        return r675263;
}

double f(double x, double y, double z, double t, double a) {
        double r675264 = z;
        double r675265 = 9.0;
        double r675266 = r675264 * r675265;
        double r675267 = t;
        double r675268 = r675266 * r675267;
        double r675269 = -2.790490462170374e+199;
        bool r675270 = r675268 <= r675269;
        double r675271 = x;
        double r675272 = y;
        double r675273 = r675271 * r675272;
        double r675274 = a;
        double r675275 = 2.0;
        double r675276 = r675274 * r675275;
        double r675277 = r675273 / r675276;
        double r675278 = 1.0;
        double r675279 = r675264 / r675278;
        double r675280 = r675265 / r675274;
        double r675281 = r675267 / r675275;
        double r675282 = r675280 * r675281;
        double r675283 = r675279 * r675282;
        double r675284 = r675277 - r675283;
        double r675285 = -3.636338125685552e-268;
        bool r675286 = r675268 <= r675285;
        double r675287 = r675276 / r675272;
        double r675288 = r675271 / r675287;
        double r675289 = r675268 / r675276;
        double r675290 = r675288 - r675289;
        double r675291 = 1.6072122227500546e-297;
        bool r675292 = r675268 <= r675291;
        double r675293 = r675271 / r675274;
        double r675294 = r675272 / r675275;
        double r675295 = r675293 * r675294;
        double r675296 = r675266 / r675274;
        double r675297 = r675296 * r675281;
        double r675298 = r675295 - r675297;
        double r675299 = 1.185335056027168e+105;
        bool r675300 = r675268 <= r675299;
        double r675301 = r675265 * r675267;
        double r675302 = r675264 * r675301;
        double r675303 = r675273 - r675302;
        double r675304 = r675278 / r675276;
        double r675305 = r675303 * r675304;
        double r675306 = r675300 ? r675305 : r675298;
        double r675307 = r675292 ? r675298 : r675306;
        double r675308 = r675286 ? r675290 : r675307;
        double r675309 = r675270 ? r675284 : r675308;
        return r675309;
}

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.7
Herbie4.5
\[\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 4 regimes
  2. if (* (* z 9.0) t) < -2.790490462170374e+199

    1. Initial program 30.2

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

      \[\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-frac6.9

      \[\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 *-un-lft-identity6.9

      \[\leadsto \frac{x \cdot y}{a \cdot 2} - \frac{z \cdot 9}{\color{blue}{1 \cdot a}} \cdot \frac{t}{2}\]
    8. Applied times-frac6.7

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

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

    if -2.790490462170374e+199 < (* (* z 9.0) t) < -3.636338125685552e-268

    1. Initial program 3.7

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied div-sub3.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 associate-/l*4.5

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

    if -3.636338125685552e-268 < (* (* z 9.0) t) < 1.6072122227500546e-297 or 1.185335056027168e+105 < (* (* z 9.0) t)

    1. Initial program 11.6

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

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

      \[\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-frac5.3

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

    if 1.6072122227500546e-297 < (* (* z 9.0) t) < 1.185335056027168e+105

    1. Initial program 3.1

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied associate-*l*3.1

      \[\leadsto \frac{x \cdot y - \color{blue}{z \cdot \left(9 \cdot t\right)}}{a \cdot 2}\]
    4. Using strategy rm
    5. Applied div-inv3.2

      \[\leadsto \color{blue}{\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification4.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \le -2.7904904621703741 \cdot 10^{199}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z}{1} \cdot \left(\frac{9}{a} \cdot \frac{t}{2}\right)\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le -3.636338125685552 \cdot 10^{-268}:\\ \;\;\;\;\frac{x}{\frac{a \cdot 2}{y}} - \frac{\left(z \cdot 9\right) \cdot t}{a \cdot 2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.6072122227500546 \cdot 10^{-297}:\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 1.185335056027168 \cdot 10^{105}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot \frac{y}{2} - \frac{z \cdot 9}{a} \cdot \frac{t}{2}\\ \end{array}\]

Reproduce

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