Average Error: 7.9 → 0.9
Time: 12.5s
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}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -2.762687511824911997115011884217564654955 \cdot 10^{-81}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.59957440222659175559693417314143233271 \cdot 10^{-181} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 5.586555695057457537923193566813453205688 \cdot 10^{253}\right):\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \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}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

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

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.59957440222659175559693417314143233271 \cdot 10^{-181} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 5.586555695057457537923193566813453205688 \cdot 10^{253}\right):\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r799312 = x;
        double r799313 = y;
        double r799314 = r799312 * r799313;
        double r799315 = z;
        double r799316 = 9.0;
        double r799317 = r799315 * r799316;
        double r799318 = t;
        double r799319 = r799317 * r799318;
        double r799320 = r799314 - r799319;
        double r799321 = a;
        double r799322 = 2.0;
        double r799323 = r799321 * r799322;
        double r799324 = r799320 / r799323;
        return r799324;
}

double f(double x, double y, double z, double t, double a) {
        double r799325 = x;
        double r799326 = y;
        double r799327 = r799325 * r799326;
        double r799328 = z;
        double r799329 = 9.0;
        double r799330 = r799328 * r799329;
        double r799331 = t;
        double r799332 = r799330 * r799331;
        double r799333 = r799327 - r799332;
        double r799334 = -inf.0;
        bool r799335 = r799333 <= r799334;
        double r799336 = 0.5;
        double r799337 = a;
        double r799338 = r799337 / r799326;
        double r799339 = r799325 / r799338;
        double r799340 = r799336 * r799339;
        double r799341 = 4.5;
        double r799342 = r799341 * r799331;
        double r799343 = r799328 / r799337;
        double r799344 = r799342 * r799343;
        double r799345 = r799340 - r799344;
        double r799346 = -2.762687511824912e-81;
        bool r799347 = r799333 <= r799346;
        double r799348 = r799327 / r799337;
        double r799349 = r799336 * r799348;
        double r799350 = r799331 * r799328;
        double r799351 = r799341 * r799350;
        double r799352 = 1.0;
        double r799353 = r799352 / r799337;
        double r799354 = r799351 * r799353;
        double r799355 = r799349 - r799354;
        double r799356 = 4.599574402226592e-181;
        bool r799357 = r799333 <= r799356;
        double r799358 = 5.5865556950574575e+253;
        bool r799359 = r799333 <= r799358;
        double r799360 = !r799359;
        bool r799361 = r799357 || r799360;
        double r799362 = 2.0;
        double r799363 = r799337 * r799362;
        double r799364 = r799363 / r799333;
        double r799365 = r799352 / r799364;
        double r799366 = r799361 ? r799345 : r799365;
        double r799367 = r799347 ? r799355 : r799366;
        double r799368 = r799335 ? r799345 : r799367;
        return r799368;
}

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.9
Target5.6
Herbie0.9
\[\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 or -2.762687511824912e-81 < (- (* x y) (* (* z 9.0) t)) < 4.599574402226592e-181 or 5.5865556950574575e+253 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 27.0

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

      \[\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-identity14.7

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

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

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

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

    if -inf.0 < (- (* x y) (* (* z 9.0) t)) < -2.762687511824912e-81

    1. Initial program 0.3

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

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

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

    if 4.599574402226592e-181 < (- (* x y) (* (* z 9.0) t)) < 5.5865556950574575e+253

    1. Initial program 0.3

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

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

    \[\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}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -2.762687511824911997115011884217564654955 \cdot 10^{-81}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.59957440222659175559693417314143233271 \cdot 10^{-181} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 5.586555695057457537923193566813453205688 \cdot 10^{253}\right):\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019350 +o rules:numerics
(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)))