Average Error: 7.6 → 0.4
Time: 4.3s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -1.36857222160745089 \cdot 10^{274}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.01111215189906504 \cdot 10^{-182}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.5724639025951766 \cdot 10^{-309}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{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 - \left(z \cdot 9\right) \cdot t \le -1.36857222160745089 \cdot 10^{274}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\

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

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

\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\
\;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r685988 = x;
        double r685989 = y;
        double r685990 = r685988 * r685989;
        double r685991 = z;
        double r685992 = 9.0;
        double r685993 = r685991 * r685992;
        double r685994 = t;
        double r685995 = r685993 * r685994;
        double r685996 = r685990 - r685995;
        double r685997 = a;
        double r685998 = 2.0;
        double r685999 = r685997 * r685998;
        double r686000 = r685996 / r685999;
        return r686000;
}

double f(double x, double y, double z, double t, double a) {
        double r686001 = x;
        double r686002 = y;
        double r686003 = r686001 * r686002;
        double r686004 = z;
        double r686005 = 9.0;
        double r686006 = r686004 * r686005;
        double r686007 = t;
        double r686008 = r686006 * r686007;
        double r686009 = r686003 - r686008;
        double r686010 = -1.3685722216074509e+274;
        bool r686011 = r686009 <= r686010;
        double r686012 = 0.5;
        double r686013 = a;
        double r686014 = r686013 / r686002;
        double r686015 = r686001 / r686014;
        double r686016 = r686012 * r686015;
        double r686017 = 4.5;
        double r686018 = r686007 * r686017;
        double r686019 = r686004 / r686013;
        double r686020 = r686018 * r686019;
        double r686021 = r686016 - r686020;
        double r686022 = -8.011112151899065e-182;
        bool r686023 = r686009 <= r686022;
        double r686024 = r686003 / r686013;
        double r686025 = r686012 * r686024;
        double r686026 = r686007 * r686004;
        double r686027 = r686017 * r686026;
        double r686028 = r686027 / r686013;
        double r686029 = r686025 - r686028;
        double r686030 = 4.572463902595177e-309;
        bool r686031 = r686009 <= r686030;
        double r686032 = 2.9481906601273705e+262;
        bool r686033 = r686009 <= r686032;
        double r686034 = r686012 / r686013;
        double r686035 = 1.0;
        double r686036 = r686035 / r686002;
        double r686037 = r686001 / r686036;
        double r686038 = r686034 * r686037;
        double r686039 = r686026 / r686013;
        double r686040 = r686017 * r686039;
        double r686041 = r686038 - r686040;
        double r686042 = r686033 ? r686041 : r686021;
        double r686043 = r686031 ? r686021 : r686042;
        double r686044 = r686023 ? r686029 : r686043;
        double r686045 = r686011 ? r686021 : r686044;
        return r686045;
}

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.8
Herbie0.4
\[\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) (* (* z 9.0) t)) < -1.3685722216074509e+274 or -8.011112151899065e-182 < (- (* x y) (* (* z 9.0) t)) < 4.572463902595177e-309 or 2.9481906601273705e+262 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 36.2

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

      \[\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*18.8

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity18.8

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

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \color{blue}{\left(\frac{t}{1} \cdot \frac{z}{a}\right)}\]
    8. Applied associate-*r*0.8

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

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

    if -1.3685722216074509e+274 < (- (* x y) (* (* z 9.0) t)) < -8.011112151899065e-182

    1. Initial program 0.3

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

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

    if 4.572463902595177e-309 < (- (* x y) (* (* z 9.0) t)) < 2.9481906601273705e+262

    1. Initial program 0.3

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied div-inv4.8

      \[\leadsto 0.5 \cdot \frac{x}{\color{blue}{a \cdot \frac{1}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    7. Applied *-un-lft-identity4.8

      \[\leadsto 0.5 \cdot \frac{\color{blue}{1 \cdot x}}{a \cdot \frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Applied times-frac0.4

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{1}{a} \cdot \frac{x}{\frac{1}{y}}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
    9. Applied associate-*r*0.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -1.36857222160745089 \cdot 10^{274}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.01111215189906504 \cdot 10^{-182}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 4.5724639025951766 \cdot 10^{-309}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.94819066012737046 \cdot 10^{262}:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{x}{\frac{1}{y}} - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \end{array}\]

Reproduce

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