Average Error: 8.0 → 5.9
Time: 19.4s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2 \le -1.356756991660825556619789092465379933879 \cdot 10^{85}:\\ \;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{elif}\;a \cdot 2 \le 523961.87070419988594949245452880859375:\\ \;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - \frac{\left(t \cdot z\right) \cdot 4.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{a} \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}\;a \cdot 2 \le -1.356756991660825556619789092465379933879 \cdot 10^{85}:\\
\;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{a} \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 r34050534 = x;
        double r34050535 = y;
        double r34050536 = r34050534 * r34050535;
        double r34050537 = z;
        double r34050538 = 9.0;
        double r34050539 = r34050537 * r34050538;
        double r34050540 = t;
        double r34050541 = r34050539 * r34050540;
        double r34050542 = r34050536 - r34050541;
        double r34050543 = a;
        double r34050544 = 2.0;
        double r34050545 = r34050543 * r34050544;
        double r34050546 = r34050542 / r34050545;
        return r34050546;
}

double f(double x, double y, double z, double t, double a) {
        double r34050547 = a;
        double r34050548 = 2.0;
        double r34050549 = r34050547 * r34050548;
        double r34050550 = -1.3567569916608256e+85;
        bool r34050551 = r34050549 <= r34050550;
        double r34050552 = y;
        double r34050553 = x;
        double r34050554 = r34050552 * r34050553;
        double r34050555 = r34050554 / r34050547;
        double r34050556 = 0.5;
        double r34050557 = r34050555 * r34050556;
        double r34050558 = 4.5;
        double r34050559 = t;
        double r34050560 = cbrt(r34050547);
        double r34050561 = r34050560 * r34050560;
        double r34050562 = r34050559 / r34050561;
        double r34050563 = z;
        double r34050564 = r34050563 / r34050560;
        double r34050565 = r34050562 * r34050564;
        double r34050566 = r34050558 * r34050565;
        double r34050567 = r34050557 - r34050566;
        double r34050568 = 523961.8707041999;
        bool r34050569 = r34050549 <= r34050568;
        double r34050570 = r34050559 * r34050563;
        double r34050571 = r34050570 * r34050558;
        double r34050572 = r34050571 / r34050547;
        double r34050573 = r34050557 - r34050572;
        double r34050574 = r34050547 / r34050563;
        double r34050575 = r34050559 / r34050574;
        double r34050576 = r34050575 * r34050558;
        double r34050577 = r34050557 - r34050576;
        double r34050578 = r34050569 ? r34050573 : r34050577;
        double r34050579 = r34050551 ? r34050567 : r34050578;
        return r34050579;
}

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

Original8.0
Target6.0
Herbie5.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 (* a 2.0) < -1.3567569916608256e+85

    1. Initial program 13.8

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt14.0

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

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

    if -1.3567569916608256e+85 < (* a 2.0) < 523961.8707041999

    1. Initial program 2.1

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

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

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

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

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

    if 523961.8707041999 < (* a 2.0)

    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 associate-*l*11.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -1.356756991660825556619789092465379933879 \cdot 10^{85}:\\ \;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\ \mathbf{elif}\;a \cdot 2 \le 523961.87070419988594949245452880859375:\\ \;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - \frac{\left(t \cdot z\right) \cdot 4.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{a} \cdot 0.5 - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \end{array}\]

Reproduce

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