Average Error: 7.3 → 6.2
Time: 18.7s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2.0 \le -8.452560769864224 \cdot 10^{+197}:\\ \;\;\;\;\left(x \cdot \frac{y}{a}\right) \cdot 0.5 - 4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{elif}\;a \cdot 2.0 \le 1.9902573105400113 \cdot 10^{+77}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{\left(z \cdot t\right) \cdot 4.5}{a}\\ \mathbf{elif}\;a \cdot 2.0 \le 3.2154246053472375 \cdot 10^{+277}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{y}{a}\right) \cdot 0.5 - 4.5 \cdot \frac{z \cdot t}{a}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}
\begin{array}{l}
\mathbf{if}\;a \cdot 2.0 \le -8.452560769864224 \cdot 10^{+197}:\\
\;\;\;\;\left(x \cdot \frac{y}{a}\right) \cdot 0.5 - 4.5 \cdot \frac{z \cdot t}{a}\\

\mathbf{elif}\;a \cdot 2.0 \le 1.9902573105400113 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{\left(z \cdot t\right) \cdot 4.5}{a}\\

\mathbf{elif}\;a \cdot 2.0 \le 3.2154246053472375 \cdot 10^{+277}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{t}{\frac{a}{z}} \cdot 4.5\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r36110755 = x;
        double r36110756 = y;
        double r36110757 = r36110755 * r36110756;
        double r36110758 = z;
        double r36110759 = 9.0;
        double r36110760 = r36110758 * r36110759;
        double r36110761 = t;
        double r36110762 = r36110760 * r36110761;
        double r36110763 = r36110757 - r36110762;
        double r36110764 = a;
        double r36110765 = 2.0;
        double r36110766 = r36110764 * r36110765;
        double r36110767 = r36110763 / r36110766;
        return r36110767;
}

double f(double x, double y, double z, double t, double a) {
        double r36110768 = a;
        double r36110769 = 2.0;
        double r36110770 = r36110768 * r36110769;
        double r36110771 = -8.452560769864224e+197;
        bool r36110772 = r36110770 <= r36110771;
        double r36110773 = x;
        double r36110774 = y;
        double r36110775 = r36110774 / r36110768;
        double r36110776 = r36110773 * r36110775;
        double r36110777 = 0.5;
        double r36110778 = r36110776 * r36110777;
        double r36110779 = 4.5;
        double r36110780 = z;
        double r36110781 = t;
        double r36110782 = r36110780 * r36110781;
        double r36110783 = r36110782 / r36110768;
        double r36110784 = r36110779 * r36110783;
        double r36110785 = r36110778 - r36110784;
        double r36110786 = 1.9902573105400113e+77;
        bool r36110787 = r36110770 <= r36110786;
        double r36110788 = r36110774 * r36110773;
        double r36110789 = r36110788 / r36110768;
        double r36110790 = r36110777 * r36110789;
        double r36110791 = r36110782 * r36110779;
        double r36110792 = r36110791 / r36110768;
        double r36110793 = r36110790 - r36110792;
        double r36110794 = 3.2154246053472375e+277;
        bool r36110795 = r36110770 <= r36110794;
        double r36110796 = r36110768 / r36110780;
        double r36110797 = r36110781 / r36110796;
        double r36110798 = r36110797 * r36110779;
        double r36110799 = r36110790 - r36110798;
        double r36110800 = r36110795 ? r36110799 : r36110785;
        double r36110801 = r36110787 ? r36110793 : r36110800;
        double r36110802 = r36110772 ? r36110785 : r36110801;
        return r36110802;
}

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.3
Target5.5
Herbie6.2
\[\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.144030707833976 \cdot 10^{+99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9.0 \cdot t\right)}{a \cdot 2.0}\\ \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) < -8.452560769864224e+197 or 3.2154246053472375e+277 < (* a 2.0)

    1. Initial program 13.7

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

      \[\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-identity13.5

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

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

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

    if -8.452560769864224e+197 < (* a 2.0) < 1.9902573105400113e+77

    1. Initial program 3.8

      \[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
    2. Taylor expanded around 0 3.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 associate-*r/3.8

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

    if 1.9902573105400113e+77 < (* a 2.0) < 3.2154246053472375e+277

    1. Initial program 12.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2.0 \le -8.452560769864224 \cdot 10^{+197}:\\ \;\;\;\;\left(x \cdot \frac{y}{a}\right) \cdot 0.5 - 4.5 \cdot \frac{z \cdot t}{a}\\ \mathbf{elif}\;a \cdot 2.0 \le 1.9902573105400113 \cdot 10^{+77}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{\left(z \cdot t\right) \cdot 4.5}{a}\\ \mathbf{elif}\;a \cdot 2.0 \le 3.2154246053472375 \cdot 10^{+277}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - \frac{t}{\frac{a}{z}} \cdot 4.5\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{y}{a}\right) \cdot 0.5 - 4.5 \cdot \frac{z \cdot t}{a}\\ \end{array}\]

Reproduce

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