Average Error: 7.9 → 0.6
Time: 22.9s
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 -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.328488004665020601912433058328595852611 \cdot 10^{-172}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.395800868589944224912154246744742554327 \cdot 10^{-238}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 1.357521776657596255493501226834911842863 \cdot 10^{232}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\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 -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\
\;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r469897 = x;
        double r469898 = y;
        double r469899 = r469897 * r469898;
        double r469900 = z;
        double r469901 = 9.0;
        double r469902 = r469900 * r469901;
        double r469903 = t;
        double r469904 = r469902 * r469903;
        double r469905 = r469899 - r469904;
        double r469906 = a;
        double r469907 = 2.0;
        double r469908 = r469906 * r469907;
        double r469909 = r469905 / r469908;
        return r469909;
}

double f(double x, double y, double z, double t, double a) {
        double r469910 = x;
        double r469911 = y;
        double r469912 = r469910 * r469911;
        double r469913 = z;
        double r469914 = 9.0;
        double r469915 = r469913 * r469914;
        double r469916 = t;
        double r469917 = r469915 * r469916;
        double r469918 = r469912 - r469917;
        double r469919 = -7.176900408502955e+212;
        bool r469920 = r469918 <= r469919;
        double r469921 = 0.5;
        double r469922 = r469921 * r469910;
        double r469923 = a;
        double r469924 = r469911 / r469923;
        double r469925 = r469922 * r469924;
        double r469926 = 4.5;
        double r469927 = r469926 * r469916;
        double r469928 = r469913 / r469923;
        double r469929 = r469927 * r469928;
        double r469930 = r469925 - r469929;
        double r469931 = -8.328488004665021e-172;
        bool r469932 = r469918 <= r469931;
        double r469933 = r469914 * r469916;
        double r469934 = r469913 * r469933;
        double r469935 = r469912 - r469934;
        double r469936 = 2.0;
        double r469937 = r469923 * r469936;
        double r469938 = r469935 / r469937;
        double r469939 = 3.395800868589944e-238;
        bool r469940 = r469918 <= r469939;
        double r469941 = r469923 / r469913;
        double r469942 = r469916 / r469941;
        double r469943 = r469926 * r469942;
        double r469944 = r469925 - r469943;
        double r469945 = 1.3575217766575963e+232;
        bool r469946 = r469918 <= r469945;
        double r469947 = r469946 ? r469938 : r469930;
        double r469948 = r469940 ? r469944 : r469947;
        double r469949 = r469932 ? r469938 : r469948;
        double r469950 = r469920 ? r469930 : r469949;
        return r469950;
}

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.9
Target5.6
Herbie0.6
\[\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 3 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -7.176900408502955e+212 or 1.3575217766575963e+232 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 33.3

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity17.8

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

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

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

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

    if -7.176900408502955e+212 < (- (* x y) (* (* z 9.0) t)) < -8.328488004665021e-172 or 3.395800868589944e-238 < (- (* x y) (* (* z 9.0) t)) < 1.3575217766575963e+232

    1. Initial program 0.3

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

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

    if -8.328488004665021e-172 < (- (* x y) (* (* z 9.0) t)) < 3.395800868589944e-238

    1. Initial program 6.7

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \frac{y}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
    8. Using strategy rm
    9. Applied associate-/l*1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -7.176900408502955352877377596419789607004 \cdot 10^{212}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -8.328488004665020601912433058328595852611 \cdot 10^{-172}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.395800868589944224912154246744742554327 \cdot 10^{-238}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 1.357521776657596255493501226834911842863 \cdot 10^{232}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot x\right) \cdot \frac{y}{a} - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019305 +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.090464557976709e86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.14403070783397609e99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9) t)) (* a 2)))