Average Error: 7.4 → 5.1
Time: 18.5s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -9.660763965508467762144727294322758643538 \cdot 10^{-31}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot 4.5\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le -5.957190730987083552549836165375073036366 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - \sqrt{4.5} \cdot \left(\sqrt{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{elif}\;x \cdot y \le 1.75883717865655323524967542350152746508 \cdot 10^{-268}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \le 2.508463496121614942709578561102143380877 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - \sqrt{4.5} \cdot \left(\sqrt{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \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 \le -9.660763965508467762144727294322758643538 \cdot 10^{-31}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot 4.5\right) \cdot \frac{z}{\sqrt[3]{a}}\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \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 r33188071 = x;
        double r33188072 = y;
        double r33188073 = r33188071 * r33188072;
        double r33188074 = z;
        double r33188075 = 9.0;
        double r33188076 = r33188074 * r33188075;
        double r33188077 = t;
        double r33188078 = r33188076 * r33188077;
        double r33188079 = r33188073 - r33188078;
        double r33188080 = a;
        double r33188081 = 2.0;
        double r33188082 = r33188080 * r33188081;
        double r33188083 = r33188079 / r33188082;
        return r33188083;
}

double f(double x, double y, double z, double t, double a) {
        double r33188084 = x;
        double r33188085 = y;
        double r33188086 = r33188084 * r33188085;
        double r33188087 = -9.660763965508468e-31;
        bool r33188088 = r33188086 <= r33188087;
        double r33188089 = a;
        double r33188090 = r33188089 / r33188085;
        double r33188091 = r33188084 / r33188090;
        double r33188092 = 0.5;
        double r33188093 = r33188091 * r33188092;
        double r33188094 = t;
        double r33188095 = cbrt(r33188089);
        double r33188096 = r33188095 * r33188095;
        double r33188097 = r33188094 / r33188096;
        double r33188098 = 4.5;
        double r33188099 = r33188097 * r33188098;
        double r33188100 = z;
        double r33188101 = r33188100 / r33188095;
        double r33188102 = r33188099 * r33188101;
        double r33188103 = r33188093 - r33188102;
        double r33188104 = -5.9571907309870836e-220;
        bool r33188105 = r33188086 <= r33188104;
        double r33188106 = r33188086 / r33188089;
        double r33188107 = r33188106 * r33188092;
        double r33188108 = sqrt(r33188098);
        double r33188109 = r33188094 * r33188100;
        double r33188110 = r33188109 / r33188089;
        double r33188111 = r33188108 * r33188110;
        double r33188112 = r33188108 * r33188111;
        double r33188113 = r33188107 - r33188112;
        double r33188114 = 1.7588371786565532e-268;
        bool r33188115 = r33188086 <= r33188114;
        double r33188116 = r33188098 * r33188094;
        double r33188117 = r33188100 / r33188089;
        double r33188118 = r33188116 * r33188117;
        double r33188119 = r33188093 - r33188118;
        double r33188120 = 2.508463496121615e+198;
        bool r33188121 = r33188086 <= r33188120;
        double r33188122 = r33188121 ? r33188113 : r33188119;
        double r33188123 = r33188115 ? r33188119 : r33188122;
        double r33188124 = r33188105 ? r33188113 : r33188123;
        double r33188125 = r33188088 ? r33188103 : r33188124;
        return r33188125;
}

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.4
Target5.4
Herbie5.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 3 regimes
  2. if (* x y) < -9.660763965508468e-31

    1. Initial program 11.3

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

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

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

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t \cdot z}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    7. Applied times-frac8.0

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

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

    if -9.660763965508468e-31 < (* x y) < -5.9571907309870836e-220 or 1.7588371786565532e-268 < (* x y) < 2.508463496121615e+198

    1. Initial program 3.5

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\left(\sqrt{4.5} \cdot \sqrt{4.5}\right)} \cdot \frac{t \cdot z}{a}\]
    5. Applied associate-*l*3.8

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

    if -5.9571907309870836e-220 < (* x y) < 1.7588371786565532e-268 or 2.508463496121615e+198 < (* x y)

    1. Initial program 10.7

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -9.660763965508467762144727294322758643538 \cdot 10^{-31}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot 4.5\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;x \cdot y \le -5.957190730987083552549836165375073036366 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - \sqrt{4.5} \cdot \left(\sqrt{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{elif}\;x \cdot y \le 1.75883717865655323524967542350152746508 \cdot 10^{-268}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \le 2.508463496121614942709578561102143380877 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot y}{a} \cdot 0.5 - \sqrt{4.5} \cdot \left(\sqrt{4.5} \cdot \frac{t \cdot z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} \cdot 0.5 - \left(4.5 \cdot t\right) \cdot \frac{z}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"

  :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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))