Average Error: 7.8 → 1.0
Time: 4.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 = -\infty \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.3253015755175787 \cdot 10^{290}\right):\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x \cdot y\right) \cdot \frac{1}{a}\right) - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \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 \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.3253015755175787 \cdot 10^{290}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r781558 = x;
        double r781559 = y;
        double r781560 = r781558 * r781559;
        double r781561 = z;
        double r781562 = 9.0;
        double r781563 = r781561 * r781562;
        double r781564 = t;
        double r781565 = r781563 * r781564;
        double r781566 = r781560 - r781565;
        double r781567 = a;
        double r781568 = 2.0;
        double r781569 = r781567 * r781568;
        double r781570 = r781566 / r781569;
        return r781570;
}

double f(double x, double y, double z, double t, double a) {
        double r781571 = x;
        double r781572 = y;
        double r781573 = r781571 * r781572;
        double r781574 = z;
        double r781575 = 9.0;
        double r781576 = r781574 * r781575;
        double r781577 = t;
        double r781578 = r781576 * r781577;
        double r781579 = r781573 - r781578;
        double r781580 = -inf.0;
        bool r781581 = r781579 <= r781580;
        double r781582 = 3.325301575517579e+290;
        bool r781583 = r781579 <= r781582;
        double r781584 = !r781583;
        bool r781585 = r781581 || r781584;
        double r781586 = 0.5;
        double r781587 = a;
        double r781588 = cbrt(r781587);
        double r781589 = r781588 * r781588;
        double r781590 = r781571 / r781589;
        double r781591 = r781572 / r781588;
        double r781592 = r781590 * r781591;
        double r781593 = r781586 * r781592;
        double r781594 = 4.5;
        double r781595 = r781587 / r781574;
        double r781596 = r781577 / r781595;
        double r781597 = r781594 * r781596;
        double r781598 = r781593 - r781597;
        double r781599 = 1.0;
        double r781600 = r781599 / r781587;
        double r781601 = r781573 * r781600;
        double r781602 = r781586 * r781601;
        double r781603 = r781577 * r781574;
        double r781604 = r781594 * r781603;
        double r781605 = r781604 / r781587;
        double r781606 = r781602 - r781605;
        double r781607 = r781585 ? r781598 : r781606;
        return r781607;
}

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.5
Herbie1.0
\[\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 2 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -inf.0 or 3.325301575517579e+290 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 60.0

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

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

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

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

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

    if -inf.0 < (- (* x y) (* (* z 9.0) t)) < 3.325301575517579e+290

    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 associate-*r/0.9

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\frac{4.5 \cdot \left(t \cdot z\right)}{a}}\]
    5. Using strategy rm
    6. Applied div-inv1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t = -\infty \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.3253015755175787 \cdot 10^{290}\right):\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x \cdot y\right) \cdot \frac{1}{a}\right) - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020081 +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)))