Average Error: 7.5 → 0.9
Time: 43.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 r31486839 = x;
        double r31486840 = y;
        double r31486841 = r31486839 * r31486840;
        double r31486842 = z;
        double r31486843 = 9.0;
        double r31486844 = r31486842 * r31486843;
        double r31486845 = t;
        double r31486846 = r31486844 * r31486845;
        double r31486847 = r31486841 - r31486846;
        double r31486848 = a;
        double r31486849 = 2.0;
        double r31486850 = r31486848 * r31486849;
        double r31486851 = r31486847 / r31486850;
        return r31486851;
}

double f(double x, double y, double z, double t, double a) {
        double r31486852 = y;
        double r31486853 = x;
        double r31486854 = r31486852 * r31486853;
        double r31486855 = 9.0;
        double r31486856 = z;
        double r31486857 = r31486855 * r31486856;
        double r31486858 = t;
        double r31486859 = r31486857 * r31486858;
        double r31486860 = r31486854 - r31486859;
        double r31486861 = -2.729495768240093e+200;
        bool r31486862 = r31486860 <= r31486861;
        double r31486863 = 0.5;
        double r31486864 = a;
        double r31486865 = r31486852 / r31486864;
        double r31486866 = r31486853 * r31486865;
        double r31486867 = r31486863 * r31486866;
        double r31486868 = r31486864 / r31486856;
        double r31486869 = r31486858 / r31486868;
        double r31486870 = 4.5;
        double r31486871 = r31486869 * r31486870;
        double r31486872 = r31486867 - r31486871;
        double r31486873 = 7.567737085414772e+268;
        bool r31486874 = r31486860 <= r31486873;
        double r31486875 = r31486854 / r31486864;
        double r31486876 = r31486863 * r31486875;
        double r31486877 = cbrt(r31486870);
        double r31486878 = r31486877 * r31486877;
        double r31486879 = r31486858 * r31486856;
        double r31486880 = r31486879 / r31486864;
        double r31486881 = r31486880 * r31486877;
        double r31486882 = r31486878 * r31486881;
        double r31486883 = r31486876 - r31486882;
        double r31486884 = r31486864 / r31486852;
        double r31486885 = r31486853 / r31486884;
        double r31486886 = r31486885 * r31486863;
        double r31486887 = r31486886 - r31486871;
        double r31486888 = r31486874 ? r31486883 : r31486887;
        double r31486889 = r31486862 ? r31486872 : r31486888;
        return r31486889;
}

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 +o rules:numerics
(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)))