Average Error: 7.5 → 6.1
Time: 15.9s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -1.42264071494389898098327431764394710599 \cdot 10^{-30}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \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}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;a \cdot 2 \le -1.42264071494389898098327431764394710599 \cdot 10^{-30}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\

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

\mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\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 r463824 = x;
        double r463825 = y;
        double r463826 = r463824 * r463825;
        double r463827 = z;
        double r463828 = 9.0;
        double r463829 = r463827 * r463828;
        double r463830 = t;
        double r463831 = r463829 * r463830;
        double r463832 = r463826 - r463831;
        double r463833 = a;
        double r463834 = 2.0;
        double r463835 = r463833 * r463834;
        double r463836 = r463832 / r463835;
        return r463836;
}

double f(double x, double y, double z, double t, double a) {
        double r463837 = a;
        double r463838 = 2.0;
        double r463839 = r463837 * r463838;
        double r463840 = -5.526614624971197e+247;
        bool r463841 = r463839 <= r463840;
        double r463842 = 0.5;
        double r463843 = x;
        double r463844 = y;
        double r463845 = r463843 * r463844;
        double r463846 = r463845 / r463837;
        double r463847 = r463842 * r463846;
        double r463848 = 4.5;
        double r463849 = t;
        double r463850 = z;
        double r463851 = r463837 / r463850;
        double r463852 = r463849 / r463851;
        double r463853 = r463848 * r463852;
        double r463854 = r463847 - r463853;
        double r463855 = -1.422640714943899e-30;
        bool r463856 = r463839 <= r463855;
        double r463857 = r463844 / r463837;
        double r463858 = r463843 * r463857;
        double r463859 = r463842 * r463858;
        double r463860 = r463849 * r463850;
        double r463861 = r463860 / r463837;
        double r463862 = r463848 * r463861;
        double r463863 = r463859 - r463862;
        double r463864 = 4.940347943794864e-102;
        bool r463865 = r463839 <= r463864;
        double r463866 = 9.0;
        double r463867 = r463866 * r463849;
        double r463868 = r463850 * r463867;
        double r463869 = r463845 - r463868;
        double r463870 = 1.0;
        double r463871 = r463870 / r463839;
        double r463872 = r463869 * r463871;
        double r463873 = 6.077447378939868e+221;
        bool r463874 = r463839 <= r463873;
        double r463875 = r463837 / r463844;
        double r463876 = r463843 / r463875;
        double r463877 = r463842 * r463876;
        double r463878 = r463877 - r463862;
        double r463879 = r463874 ? r463854 : r463878;
        double r463880 = r463865 ? r463872 : r463879;
        double r463881 = r463856 ? r463863 : r463880;
        double r463882 = r463841 ? r463854 : r463881;
        return r463882;
}

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.5
Herbie6.1
\[\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 4 regimes
  2. if (* a 2.0) < -5.526614624971197e+247 or 4.940347943794864e-102 < (* a 2.0) < 6.077447378939868e+221

    1. Initial program 8.1

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

      \[\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.9

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

    if -5.526614624971197e+247 < (* a 2.0) < -1.422640714943899e-30

    1. Initial program 9.2

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

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

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

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

    if -1.422640714943899e-30 < (* a 2.0) < 4.940347943794864e-102

    1. Initial program 1.9

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied associate-*l*1.8

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

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

    if 6.077447378939868e+221 < (* a 2.0)

    1. Initial program 15.2

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -5.526614624971197016874091463897007724665 \cdot 10^{247}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le -1.42264071494389898098327431764394710599 \cdot 10^{-30}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;a \cdot 2 \le 4.940347943794864332566063191313488771801 \cdot 10^{-102}:\\ \;\;\;\;\left(x \cdot y - z \cdot \left(9 \cdot t\right)\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{elif}\;a \cdot 2 \le 6.077447378939868238265068590780103982245 \cdot 10^{221}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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