Average Error: 7.7 → 1.1
Time: 15.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 \le -2.157070698117764542052953483850113531869 \cdot 10^{268}:\\ \;\;\;\;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 2.967056092002857937365330199455399222176 \cdot 10^{173}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \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 -2.157070698117764542052953483850113531869 \cdot 10^{268}:\\
\;\;\;\;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 2.967056092002857937365330199455399222176 \cdot 10^{173}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r59336 = x;
        double r59337 = y;
        double r59338 = r59336 * r59337;
        double r59339 = z;
        double r59340 = 9.0;
        double r59341 = r59339 * r59340;
        double r59342 = t;
        double r59343 = r59341 * r59342;
        double r59344 = r59338 - r59343;
        double r59345 = a;
        double r59346 = 2.0;
        double r59347 = r59345 * r59346;
        double r59348 = r59344 / r59347;
        return r59348;
}

double f(double x, double y, double z, double t, double a) {
        double r59349 = x;
        double r59350 = y;
        double r59351 = r59349 * r59350;
        double r59352 = z;
        double r59353 = 9.0;
        double r59354 = r59352 * r59353;
        double r59355 = t;
        double r59356 = r59354 * r59355;
        double r59357 = r59351 - r59356;
        double r59358 = -2.1570706981177645e+268;
        bool r59359 = r59357 <= r59358;
        double r59360 = 0.5;
        double r59361 = a;
        double r59362 = r59350 / r59361;
        double r59363 = r59349 * r59362;
        double r59364 = r59360 * r59363;
        double r59365 = 4.5;
        double r59366 = r59361 / r59352;
        double r59367 = r59355 / r59366;
        double r59368 = r59365 * r59367;
        double r59369 = r59364 - r59368;
        double r59370 = 2.967056092002858e+173;
        bool r59371 = r59357 <= r59370;
        double r59372 = r59351 / r59361;
        double r59373 = r59360 * r59372;
        double r59374 = cbrt(r59365);
        double r59375 = r59374 * r59374;
        double r59376 = r59355 * r59352;
        double r59377 = r59376 / r59361;
        double r59378 = r59374 * r59377;
        double r59379 = r59375 * r59378;
        double r59380 = r59373 - r59379;
        double r59381 = r59352 / r59361;
        double r59382 = r59355 * r59381;
        double r59383 = r59365 * r59382;
        double r59384 = r59364 - r59383;
        double r59385 = r59371 ? r59380 : r59384;
        double r59386 = r59359 ? r59369 : r59385;
        return r59386;
}

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.3
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)) < -2.1570706981177645e+268

    1. Initial program 43.4

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

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{x} \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Using strategy rm
    8. Applied associate-/l*0.5

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

    if -2.1570706981177645e+268 < (- (* x y) (* (* z 9.0) t)) < 2.967056092002858e+173

    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 add-cube-cbrt0.9

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\left(\left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \sqrt[3]{4.5}\right)} \cdot \frac{t \cdot z}{a}\]
    5. Applied associate-*l*0.9

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

    if 2.967056092002858e+173 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 24.7

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

      \[\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 *-un-lft-identity24.4

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

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

      \[\leadsto 0.5 \cdot \left(\color{blue}{x} \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity14.7

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

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

      \[\leadsto 0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(\color{blue}{t} \cdot \frac{z}{a}\right)\]
  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 -2.157070698117764542052953483850113531869 \cdot 10^{268}:\\ \;\;\;\;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 2.967056092002857937365330199455399222176 \cdot 10^{173}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\sqrt[3]{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\ \end{array}\]

Reproduce

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