Average Error: 7.5 → 6.1
Time: 14.8s
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 r424986 = x;
        double r424987 = y;
        double r424988 = r424986 * r424987;
        double r424989 = z;
        double r424990 = 9.0;
        double r424991 = r424989 * r424990;
        double r424992 = t;
        double r424993 = r424991 * r424992;
        double r424994 = r424988 - r424993;
        double r424995 = a;
        double r424996 = 2.0;
        double r424997 = r424995 * r424996;
        double r424998 = r424994 / r424997;
        return r424998;
}

double f(double x, double y, double z, double t, double a) {
        double r424999 = a;
        double r425000 = 2.0;
        double r425001 = r424999 * r425000;
        double r425002 = -5.526614624971197e+247;
        bool r425003 = r425001 <= r425002;
        double r425004 = 0.5;
        double r425005 = x;
        double r425006 = y;
        double r425007 = r425005 * r425006;
        double r425008 = r425007 / r424999;
        double r425009 = r425004 * r425008;
        double r425010 = 4.5;
        double r425011 = t;
        double r425012 = z;
        double r425013 = r424999 / r425012;
        double r425014 = r425011 / r425013;
        double r425015 = r425010 * r425014;
        double r425016 = r425009 - r425015;
        double r425017 = -1.422640714943899e-30;
        bool r425018 = r425001 <= r425017;
        double r425019 = r425006 / r424999;
        double r425020 = r425005 * r425019;
        double r425021 = r425004 * r425020;
        double r425022 = r425011 * r425012;
        double r425023 = r425022 / r424999;
        double r425024 = r425010 * r425023;
        double r425025 = r425021 - r425024;
        double r425026 = 4.940347943794864e-102;
        bool r425027 = r425001 <= r425026;
        double r425028 = 9.0;
        double r425029 = r425028 * r425011;
        double r425030 = r425012 * r425029;
        double r425031 = r425007 - r425030;
        double r425032 = 1.0;
        double r425033 = r425032 / r425001;
        double r425034 = r425031 * r425033;
        double r425035 = 6.077447378939868e+221;
        bool r425036 = r425001 <= r425035;
        double r425037 = r424999 / r425006;
        double r425038 = r425005 / r425037;
        double r425039 = r425004 * r425038;
        double r425040 = r425039 - r425024;
        double r425041 = r425036 ? r425016 : r425040;
        double r425042 = r425027 ? r425034 : r425041;
        double r425043 = r425018 ? r425025 : r425042;
        double r425044 = r425003 ? r425016 : r425043;
        return r425044;
}

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 
(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)))