Average Error: 7.5 → 0.9
Time: 57.8s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le -2.729495768240093014714208059823501869336 \cdot 10^{200}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \mathbf{elif}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le 7.567737085414772222969211502170718139615 \cdot 10^{268}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\frac{t \cdot z}{a} \cdot \sqrt[3]{4.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le -2.729495768240093014714208059823501869336 \cdot 10^{200}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \frac{t}{\frac{a}{z}} \cdot 4.5\\

\mathbf{elif}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le 7.567737085414772222969211502170718139615 \cdot 10^{268}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\frac{t \cdot z}{a} \cdot \sqrt[3]{4.5}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r35933498 = x;
        double r35933499 = y;
        double r35933500 = r35933498 * r35933499;
        double r35933501 = z;
        double r35933502 = 9.0;
        double r35933503 = r35933501 * r35933502;
        double r35933504 = t;
        double r35933505 = r35933503 * r35933504;
        double r35933506 = r35933500 - r35933505;
        double r35933507 = a;
        double r35933508 = 2.0;
        double r35933509 = r35933507 * r35933508;
        double r35933510 = r35933506 / r35933509;
        return r35933510;
}

double f(double x, double y, double z, double t, double a) {
        double r35933511 = y;
        double r35933512 = x;
        double r35933513 = r35933511 * r35933512;
        double r35933514 = 9.0;
        double r35933515 = z;
        double r35933516 = r35933514 * r35933515;
        double r35933517 = t;
        double r35933518 = r35933516 * r35933517;
        double r35933519 = r35933513 - r35933518;
        double r35933520 = -2.729495768240093e+200;
        bool r35933521 = r35933519 <= r35933520;
        double r35933522 = 0.5;
        double r35933523 = a;
        double r35933524 = r35933511 / r35933523;
        double r35933525 = r35933512 * r35933524;
        double r35933526 = r35933522 * r35933525;
        double r35933527 = r35933523 / r35933515;
        double r35933528 = r35933517 / r35933527;
        double r35933529 = 4.5;
        double r35933530 = r35933528 * r35933529;
        double r35933531 = r35933526 - r35933530;
        double r35933532 = 7.567737085414772e+268;
        bool r35933533 = r35933519 <= r35933532;
        double r35933534 = r35933513 / r35933523;
        double r35933535 = r35933522 * r35933534;
        double r35933536 = cbrt(r35933529);
        double r35933537 = r35933536 * r35933536;
        double r35933538 = r35933517 * r35933515;
        double r35933539 = r35933538 / r35933523;
        double r35933540 = r35933539 * r35933536;
        double r35933541 = r35933537 * r35933540;
        double r35933542 = r35933535 - r35933541;
        double r35933543 = r35933523 / r35933511;
        double r35933544 = r35933512 / r35933543;
        double r35933545 = r35933544 * r35933522;
        double r35933546 = r35933545 - r35933530;
        double r35933547 = r35933533 ? r35933542 : r35933546;
        double r35933548 = r35933521 ? r35933531 : r35933547;
        return r35933548;
}

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.5
Target5.4
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)) < -2.729495768240093e+200

    1. Initial program 27.7

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

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

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

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

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

    if -2.729495768240093e+200 < (- (* x y) (* (* z 9.0) t)) < 7.567737085414772e+268

    1. Initial program 0.8

      \[\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 7.567737085414772e+268 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 44.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le -2.729495768240093014714208059823501869336 \cdot 10^{200}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \mathbf{elif}\;y \cdot x - \left(9 \cdot z\right) \cdot t \le 7.567737085414772222969211502170718139615 \cdot 10^{268}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \left(\sqrt[3]{4.5} \cdot \sqrt[3]{4.5}\right) \cdot \left(\frac{t \cdot z}{a} \cdot \sqrt[3]{4.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))