Average Error: 7.6 → 4.0
Time: 7.4s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{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 \le -2.21834298495767539 \cdot 10^{236}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\

\mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\
\;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r846834 = x;
        double r846835 = y;
        double r846836 = r846834 * r846835;
        double r846837 = z;
        double r846838 = 9.0;
        double r846839 = r846837 * r846838;
        double r846840 = t;
        double r846841 = r846839 * r846840;
        double r846842 = r846836 - r846841;
        double r846843 = a;
        double r846844 = 2.0;
        double r846845 = r846843 * r846844;
        double r846846 = r846842 / r846845;
        return r846846;
}

double f(double x, double y, double z, double t, double a) {
        double r846847 = x;
        double r846848 = y;
        double r846849 = r846847 * r846848;
        double r846850 = -2.2183429849576754e+236;
        bool r846851 = r846849 <= r846850;
        double r846852 = 0.5;
        double r846853 = a;
        double r846854 = r846853 / r846848;
        double r846855 = r846847 / r846854;
        double r846856 = r846852 * r846855;
        double r846857 = 4.5;
        double r846858 = t;
        double r846859 = z;
        double r846860 = r846858 * r846859;
        double r846861 = r846860 / r846853;
        double r846862 = r846857 * r846861;
        double r846863 = r846856 - r846862;
        double r846864 = -1.360394985699375e+34;
        bool r846865 = r846849 <= r846864;
        double r846866 = r846849 / r846853;
        double r846867 = r846852 * r846866;
        double r846868 = cbrt(r846853);
        double r846869 = r846868 * r846868;
        double r846870 = r846858 / r846869;
        double r846871 = r846857 * r846870;
        double r846872 = r846859 / r846868;
        double r846873 = r846871 * r846872;
        double r846874 = r846867 - r846873;
        double r846875 = 2.9090994917840058e+187;
        bool r846876 = r846849 <= r846875;
        double r846877 = 9.0;
        double r846878 = r846877 * r846858;
        double r846879 = r846878 * r846859;
        double r846880 = r846849 - r846879;
        double r846881 = 1.0;
        double r846882 = 2.0;
        double r846883 = r846853 * r846882;
        double r846884 = r846881 / r846883;
        double r846885 = r846880 * r846884;
        double r846886 = r846876 ? r846885 : r846863;
        double r846887 = r846865 ? r846874 : r846886;
        double r846888 = r846851 ? r846863 : r846887;
        return r846888;
}

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.6
Target5.6
Herbie4.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 (* x y) < -2.2183429849576754e+236 or 2.9090994917840058e+187 < (* x y)

    1. Initial program 31.3

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

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

    if -2.2183429849576754e+236 < (* x y) < -1.360394985699375e+34

    1. Initial program 5.1

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

      \[\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}}}\]
    5. Applied times-frac2.0

      \[\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)}\]
    6. Applied associate-*r*2.1

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

    if -1.360394985699375e+34 < (* x y) < 2.9090994917840058e+187

    1. Initial program 3.9

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2}\]
    3. Using strategy rm
    4. Applied div-inv3.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -2.21834298495767539 \cdot 10^{236}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.3603949856993749 \cdot 10^{34}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le 2.9090994917840058 \cdot 10^{187}:\\ \;\;\;\;\left(x \cdot y - \left(9 \cdot t\right) \cdot z\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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