Average Error: 7.8 → 5.0
Time: 20.1s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 714062.429749303148:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{z \cdot \left(4.5 \cdot t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r547587 = x;
        double r547588 = y;
        double r547589 = r547587 * r547588;
        double r547590 = z;
        double r547591 = 9.0;
        double r547592 = r547590 * r547591;
        double r547593 = t;
        double r547594 = r547592 * r547593;
        double r547595 = r547589 - r547594;
        double r547596 = a;
        double r547597 = 2.0;
        double r547598 = r547596 * r547597;
        double r547599 = r547595 / r547598;
        return r547599;
}

double f(double x, double y, double z, double t, double a) {
        double r547600 = z;
        double r547601 = 9.0;
        double r547602 = r547600 * r547601;
        double r547603 = t;
        double r547604 = r547602 * r547603;
        double r547605 = -inf.0;
        bool r547606 = r547604 <= r547605;
        double r547607 = 0.5;
        double r547608 = x;
        double r547609 = y;
        double r547610 = r547608 * r547609;
        double r547611 = a;
        double r547612 = r547610 / r547611;
        double r547613 = r547607 * r547612;
        double r547614 = 4.5;
        double r547615 = r547614 * r547603;
        double r547616 = r547600 / r547611;
        double r547617 = r547615 * r547616;
        double r547618 = r547613 - r547617;
        double r547619 = 714062.4297493031;
        bool r547620 = r547604 <= r547619;
        double r547621 = r547600 * r547615;
        double r547622 = r547621 / r547611;
        double r547623 = r547613 - r547622;
        double r547624 = r547609 / r547611;
        double r547625 = r547608 * r547624;
        double r547626 = r547607 * r547625;
        double r547627 = r547611 / r547600;
        double r547628 = r547603 / r547627;
        double r547629 = r547614 * r547628;
        double r547630 = r547626 - r547629;
        double r547631 = r547620 ? r547623 : r547630;
        double r547632 = r547606 ? r547618 : r547631;
        return r547632;
}

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.4
Herbie5.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 3 regimes
  2. if (* (* z 9.0) t) < -inf.0

    1. Initial program 64.0

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

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

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

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

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

    if -inf.0 < (* (* z 9.0) t) < 714062.4297493031

    1. Initial program 4.3

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

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

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

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

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

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

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

    if 714062.4297493031 < (* (* z 9.0) t)

    1. Initial program 13.2

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

      \[\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-identity10.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t = -\infty:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;\left(z \cdot 9\right) \cdot t \le 714062.429749303148:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{z \cdot \left(4.5 \cdot t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

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