Average Error: 7.5 → 6.1
Time: 14.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 -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\ \;\;\;\;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}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \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 -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\
\;\;\;\;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}:\\
\;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\

\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 r478909 = x;
        double r478910 = y;
        double r478911 = r478909 * r478910;
        double r478912 = z;
        double r478913 = 9.0;
        double r478914 = r478912 * r478913;
        double r478915 = t;
        double r478916 = r478914 * r478915;
        double r478917 = r478911 - r478916;
        double r478918 = a;
        double r478919 = 2.0;
        double r478920 = r478918 * r478919;
        double r478921 = r478917 / r478920;
        return r478921;
}

double f(double x, double y, double z, double t, double a) {
        double r478922 = a;
        double r478923 = 2.0;
        double r478924 = r478922 * r478923;
        double r478925 = -5.526614624971197e+247;
        bool r478926 = r478924 <= r478925;
        double r478927 = 0.5;
        double r478928 = x;
        double r478929 = y;
        double r478930 = r478928 * r478929;
        double r478931 = r478930 / r478922;
        double r478932 = r478927 * r478931;
        double r478933 = 4.5;
        double r478934 = t;
        double r478935 = z;
        double r478936 = r478922 / r478935;
        double r478937 = r478934 / r478936;
        double r478938 = r478933 * r478937;
        double r478939 = r478932 - r478938;
        double r478940 = -2.3516292947484134e-14;
        bool r478941 = r478924 <= r478940;
        double r478942 = r478929 / r478922;
        double r478943 = r478928 * r478942;
        double r478944 = r478927 * r478943;
        double r478945 = r478934 * r478935;
        double r478946 = r478945 / r478922;
        double r478947 = r478933 * r478946;
        double r478948 = r478944 - r478947;
        double r478949 = 4.940347943794864e-102;
        bool r478950 = r478924 <= r478949;
        double r478951 = 1.0;
        double r478952 = 9.0;
        double r478953 = r478935 * r478952;
        double r478954 = r478953 * r478934;
        double r478955 = r478930 - r478954;
        double r478956 = r478924 / r478955;
        double r478957 = r478951 / r478956;
        double r478958 = 6.077447378939868e+221;
        bool r478959 = r478924 <= r478958;
        double r478960 = r478922 / r478929;
        double r478961 = r478928 / r478960;
        double r478962 = r478927 * r478961;
        double r478963 = r478962 - r478947;
        double r478964 = r478959 ? r478939 : r478963;
        double r478965 = r478950 ? r478957 : r478964;
        double r478966 = r478941 ? r478948 : r478965;
        double r478967 = r478926 ? r478939 : r478966;
        return r478967;
}

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) < -2.3516292947484134e-14

    1. Initial program 9.6

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

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

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

    if -2.3516292947484134e-14 < (* a 2.0) < 4.940347943794864e-102

    1. Initial program 1.8

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

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

    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 -2.351629294748413366835826341287596823597 \cdot 10^{-14}:\\ \;\;\;\;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}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}\\ \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 
(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)))